1

I want to add custom input type button in form. I tried following code, but it is converting it to submit type button. How can i add input type button ?

$form[custom_button] = array('#type' => 'button','#value' => t('Test Button'),);
0

It's not converting it to a submit button type, they are different

Form items of type "button" will trigger the form submission but won't trigger the hook_form_submits like a form item of type "submit" does. It's eseentially a blank button apart from hook_validate is called but in there you can do whatever special functionality your button is supposed to do

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.