how to override isSubmitted() when other posts/ajax set HttpData
- mikeb
- Member | 33
I'm using various nette forms on a various pages alongside other (non-nette)
ajax calls. these pages ajax/post etc so then Nette thinks its own forms have
been submitted: isSubmitted()=true
. but it isn't true. And then
nette overwrites setDefaultvalue() with blanks (as no such fields were
posted).
I know I can use setValue instead of setDefaultvalue(), but this will requires a kludge in many forms and controllers using the forms.
as far as I can tell the problem originates in RequestFactory
method createHttpRequest()
<?php
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD']
?>
i'd rather not overload this method. making
$_SERVER['REQUEST_METHOD']=null
will work before the form is
initially generated but that's also a bit ugly, and this mustn't happen when
nette does actually submit prior to validation.
Also, I guess nette therefore breaks when there are two or more nette forms on one page, as neither knows who was submitted (maybe each form needs to carry a unique id and createHttpRequest can check that?).
is there any other way to force Nette to regard the form as not submitted when it wasn't?
thanks
Mike
Last edited by mikeb (2017-02-03 09:44)
- David Grudl
- Nette Core | 8228
When your app sends AJAX POST request (which is not form submission), is
there a parameter named do
?
- David Grudl
- Nette Core | 8228
And are we talking about Nette\Forms\Form or Nette\Application\UI\Form?