Hello all,

How to stop form validation on simple button submission ?

I have form with one simple button and other is submit button and i dont want to check any validation when i click on simple button.

if anybody know then plz reply me.

Thanks in advance.

Comments

kamleshpatidar’s picture

hi jal,

first of all what is the need of this? if u wanna to stop form validation for a particular module then open it & find validation function.For example if u wanna to stop validation in User login form then go to User module & u will get function "user_validate_name" then u can what do u want.

Kamlesh Patidar

jalpa_bhalara’s picture

Hello Kamlesh,

Thanks for your reply, Actually i want to stop all validation for a form .. if any form element has #required = true then i also want to stop it. means any of the validation must not be run when i click on button.

I have created a new content type named "article" from admin panel and it has title and body fields where title field is required. so by default node module is run.

now i have added a new button called addnew using form_alter hook of my module and on click of addnew button i alter my "article" node form so when i click on addnew button form is loaded and validated but i dont want to validate the form.

and i dont want to change in core modules so now is there any way to stop all validation of form ?