do parameter disappears after $form->setAction

4 years ago

tomcat4x
Member | 22
+
0
-

I am not sure if thats a bug, but i am wondering that the hidden do parameter in a html form disappears when using the function

$form->setAction();

For example:

protected function createComponentSimpleForm()
{
    $form = new Form;
    $form->addText('name', 'Name:');
    $form->addSubmit('search', 'Search');
    $form->onSuccess[] = array($this,'simpleFormSucceeded');
    return $form;
}

here everything works well and after rendering the form there is an hidden parameter in the html

<input type="hidden" name="do" value="simpleForm-submit">

But after adding

$form->setAction($this->link('SearchResult:Simple'));

the hidden parameter in html form disappears.

4 years ago

Casper
Member | 253
+
0
-

There are some (cs) threads (en) about it.

You will probably need to setup the do parameter manually.

4 years ago

old.gandalf
Member | 17
+
0
-

Hello,

this is quite strange, I'm using setAction() in a project driven by Nette 2.2.3 and the ‘do’ hidden input doesn't disappear.
Have you tried calling the setAction() method before setting the onSuccess callback? I suppose it won't make any difference, but you can at least give it a try ;)

4 years ago

David Grudl
Nette Core | 6877
+
0
-

Update to Nette > 2.2.3 https://github.com/…on/issues/33

4 years ago

tomcat4x
Member | 22
+
0
-

David Grudl wrote:

Update to Nette > 2.2.3 https://github.com/…on/issues/33

I am using nette 2.3.5
Shall i downgrade?

4 years ago

tomcat4x
Member | 22
+
0
-

old.gandalf wrote:

Hello,

this is quite strange, I'm using setAction() in a project driven by Nette 2.2.3 and the ‘do’ hidden input doesn't disappear.
Have you tried calling the setAction() method before setting the onSuccess callback? I suppose it won't make any difference, but you can at least give it a try ;)

It makes no difference.

4 years ago

tomcat4x
Member | 22
+
0
-

Casper wrote:

There are some (cs) threads (en) about it.

You will probably need to setup the do parameter manually.

I can do so. But what is the sense of the setAction method if the form afterwards does not work as expected and why is there no hint in the documentation.

Last edited by tomcat4x (2015-09-28 09:18)