|
||||||||||
|
|
||||||||||
NavigationMy posts on Twitter
|
Drupal FormsBasic structure:
function my_form($form_state) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}
function my_form_validate($form, &$form_state) {
}
function my_form_submit($form, &$form_state) {
}
print drupal_get_form('my_form');
Adding Form Functionality:
$form['#attributes'] = array('enctype' => "multipart/form-data");
$form['image'] = array(
'#type' => 'file',
'#title' => t('Upload a new File'),
'#description' => t('Select a file to upload into the knowledge base.')
);
Read a submitted value $form_state['values']['var_name']; Returning messages drupal_set_message("Thank you for submitting your post.");form_set_error('var_name', 'You must enter a non-empty value as the new category name.');Update a form after submitting it $form_state['rebuild'] = TRUE; |
|
||||||||
| © Copyleft 2005-2011 - Lode Vanstechelman - Login | ||||||||||