Sample coding for calling specified function is given below.
- Both the buttons are of the same type submit (given in red color)
- but the corresponding function is invoked . (given in green color)
function abc_form($form_id, $form_state=NULL) {
// code
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#submit'=>array('abc_submit'),
);
$form['update'] = array(
'#type' => 'submit',
'#value' => t('update'),
'#submit'=>array('abc_update'),
);
retun $form;
}
function abc_submit($form_id, $form_state)
{
// this function is called when the submit button is clicked
// code
}
function abc_update($form_id, $form_state)
{
// this function is called when the update button is clicked
// code
}
No comments:
Post a Comment