Symfony confirm message if a condition is true (submit_to_remote)

579 views Asked by At

I made a radiobutton based form in Symfony. I'd like to make a confirm message, IF a radio button checked. This is my code, but it's not exactly what I want:

            <?php echo jq_submit_to_remote('deleteButton','Törlés', array(
                'url' => 'editCategory/deleteSubmenu',
                'with'=>"'value=' + getSelectedRadio()",
                'condition' => 'getSelectedRadio() != undefined',
                'confirm' => 'Are you sure?',
            )) ?>

This makes the confirm message in every case. How can I add condition to the confirm?

1

There are 1 answers

2
Maerlyn On

You won't be able to do that with symfony's helpers, you'll need to write your own JS code. That's the recommended way to do it anyway - there's a reason the javascript helpers got deprecated.