By davecoventry on
I have a form defined
function form_igallery(){
$form=Array (
'#attributes' => array('enctype' => "multipart/form-data"),
'upload'=>Array(
'#type'=>'fieldset',
'#title'=>'Upload Images',
'#description' => 'Click to expand.',
'#collapsible'=>1,
'#collapsed'=>1,
'photo1'=>Array(
'#type'=>'file',
'#title'=>'Upload First Photo',
),
'caption1'=>Array(
'#type'=>'textfield',
'#title'=>t('Caption'),
'#description'=>t('Add a Caption if desired.'),
'#maxlength'=>128
),
'group1'=>Array(
'#type'=>'textfield',
'#title'=>t('Group'),
'#description'=>t('You can group photos together.'),
'#maxlength'=>64
),
'submit'=>Array(
'#type' => 'button',
'#value' => t('Upload')
)
),
);
$form['#submit'][0]='form_igallery_submit';
return $form;
}
I am expecting this: $form['#submit'][0]='form_igallery_submit'; array element to call the following function when the submit button is clicked:
function form_igallery_submit($form, &$form_state){
drupal_set_message('Processing files....');
}But as far as I can tell this does not happen.
Can anyone see my error?
Comments
Try with my code
Hello,
Can you try with my code???
I have added one line in array of submit and this line of code is
'#executes_submit_callback' => TRUE.Please try this.
It works!
Much to my surprise!
Thank you!
Hi, I tried all the
Hi,
I tried all the suggestions here and others, and i still can't get the _submit to work, execution never gets there, i am tearing my hair out, any ideas about what's going on here?
Try this
Try this instead:
You need to set the type to submit.
Thank you.
I really have been tearing my hair out over this one.
I couldn't see what I was doing wrong.
Thanks again, to both of you.
excecution never arrives to _submit after sending the form.
Hi,
I tried all the suggestions posted here and others, and i still can't get the _submit to work, when i click the button it just reload the page, execution never gets there (box_form_submit), i am tearing my hair out, any ideas about what's going on here?
submit handler not working in drupal 7
Drupal 7:
function intelligentsystem_menu(){
....
}
function intelligent_system_home_output(){
header('Content-type: text/plain; charset=UTF-8');
header('Content-Disposition: inline');
$content = intelligent_system_home_nameform();
return $content;
}
function intelligent_system_home_nameform(){
$form['title'] = array(
'#type' => 'fieldset',
'#title' => t('Enter the information :'),
);
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Name :'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
$form['#submit'] = 'intelligent_system_home_nameform_submit';
return $form;
}
function intelligent_system_home_nameform_submit($form, &$form_state) {
drupal_set_message(t('The data is being Analyzed!!'));
}
I have tried calling a user defined function also rather than the above mentioned _submit..but nothing is working..drupal 6 used to support the above...but drupal 7 doesnt seem to..have checked out many forums..but there seems to be no solution..pls help..