We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

add properties to a form

I need to add properties to my form to work with a jquery libraries

<?php
echo $this->tag->form(array("spm_contacto/create",
                                                    "autocomplete" => "off",
                                                    "class" => "form-horizontal", 
                                                    "data-abide" => "",
                                                    "novalidate" => ""));
?>

But when you add does not save, while

<?php
echo $this->tag->form(array("spm_contacto/create",
                                                    "autocomplete" => "off",
                                                    "class" => "form-horizontal",));
?>

if it works, if you save



11.6k
edited May '16

you can use jquery append() (at end) or prepend() (at top) to add properties( .attr( ) ) or select options to your element in your document.ready()..



81.2k
edited May '16

just like that

<script>
    $(function () {
        $('#formulario').attr('data-abide', '').attr('novalidate', '');
    });
</script>

dont work



11.6k

<script> $(document).ready(function () { $('#formulario').attr('data-abide', 'myValue')... }); </script>