how to disable validation for ajax form reload
- mcmatak
- Member | 504
If i change selectbox, or change radiolist, or check checkbox, always it is a new state for form. And form muset be regenerated and as a snippet replaced.
But how to do it if i have validations. I have only one submit button.
Nothing works for me.
I have Nette 2.2.7
$button = $form->addSubmit('save', "adm.buttons.save");
$button->setValidationScope($form['number']);
result: Validation scope accepts only Nette\Forms\Container or Nette\Forms\IControl instances
but even if it would worked, i am afraid that submitting this form caused that javascript validation is triggered and it doesnt allow that the number would not be filled
next try
$form['number']->addConditionOn($form['save'], $form::SUBMITTED)->addRule($form::REQUIRED, 'adm.extensions.modal.numberValidation');
also it doesnt work
what next?
- marlonbrando921
- Member | 1
You can prevent the form from submitting with
$(“#prospects_form”).submit(function(e) {
e.preventDefault();
});
Of course, in the function, you can check for empty fields, and if anything
doesn't look right, e.preventDefault() will stop the submit.
- vignesjoseph
- Member | 1
Add this onsubmit=“return false” code:
<form name=“formname” onsubmit=“return false”>
That fixed it for me. It will still run the onClick function you specify
Selenium Training in
Chennai