- EDIT: now IT IS SOLVED.
I want a single button to execute several js commands, for example.
$nextButton = $form->addButton('Next');
:
$button_repopulate_address->js(true)->show()
$street->js(true)->closest('fieldset')->show()
when:
$nextButton->isClicked()
The sample code here assumes that you are inserting commands in the second parameter of the js call, for example:
$g->addButton('Show all buttons')->js('click',$b1->js(null,$b2->js(null,$b3->js()->show())->show())->show());
I think this is very ugly and will create code that is very difficult to execute for more than two teams.
I looked in the source and found the _prepend command that I used to solve my problem by doing the following:
if($nextButton->isClicked()){
$form->js()->_prepend($street->js(true)->closest('fieldset')->show())
->_prepend($button_repopulate_address->js(true)->show())
->execute();
}
EDIT: I just looked at the source of js (), and it seems that you can pass in a js array that calls the _prepend method for each element of the array - nice !:
$form->js(null, array(
$street->js(true)->closest('fieldset')->show(),
$button_repopulate_address->js(true)->show()
));
- SOLVED (, , , , )