If you ever tried changing your form from POST to GET with $form->setMethod(‘get’) and then render it with macro {form} … {/form} I’m sure you discovered that your submission callback doesn’t trigger. Apparently it’s difficult to resolve this in a clean way so until the Nette team finds a solution you’ll have use some sort of a hacky workaround.
The thing is to add one hidden form item that eventually triggers the form submission callback:
-
-
{form signForm}
-
…
-
{var $signalElement = Html::el(‘input’, array(
-
‘type’ => ‘hidden’,
-
‘name’ => Presenter::SIGNAL_KEY,
-
‘value’ => ‘signForm’.Presenter::NAME_SEPARATOR.’submit’
-
))}
-
{$signalElement}
-
{/form}
-
Tags: Nette Framework 2.0-beta (revision f38d86f released on 2011-08-24)