jquery - How can be send additional info on a form with several buttons on Symfony2? -
i started use several buttons on form, taking advantage of isclicked ()
method , validation groups specified each button. working fine until needed ask additional info @ time user pressed specific button.
the thing is: whenever in jquery on click event of button or submit event of form, somewhow prevents symfony of knowing button wich pressed, says clickedbutton null.
for example, when do: $form->getclickedbutton()->getname()
error: "error: call member function getname() on non-object"
even if this:
$("form").submit( function() { $("button[type='submit']").attr("disabled", true); });
the puzzling thing me have seen here advises of doing kind of thing:
$(this).append('<button />').attr('type', 'hidden').attr('name', "something").attr('value', "something");
on submit event, when it, dont seem find information on request in controller.
how can achieve sending additional info @ same time clicked button ?
million thanks
the clicked button determined using submitted data, if button name presented in post
or get
button marked clicked = true
.
now, in javascript snippet disabling button(s) , disabled fields/inputs won't presented in submitted data, therefore, sf2 not able determine button has been clicked.
as else suggested use hidden field, add form first, , fill information using javascript required.
Comments
Post a Comment