Add new Formelemts and transform it with jqtransform

Posted by user545782 on Stack Overflow See other posts from Stack Overflow or by user545782
Published on 2010-12-17T07:49:52Z Indexed on 2011/01/07 10:53 UTC
Read the original article Hit count: 187

Filed under:
|

I'm just trying to change my formfields with jqtransform.

With the following Javascript Code, i add new formfields:

    <script type="text/javascript">
        $(function() {
            var scntDiv = $('#p_scents');
            var i = $('#p_scents p').size() + 1;

            $('#addScnt').live('click', function() {

                if(i < 4){
                    $('<p>\n\
                        <label for="p_scnts">\n\
                        <input type="text" id="p_scnt" size="17" name="fmac' + i +'[]" value="" />\n\
                        <select name="fmac' + i +'[]" size="1" id="p_scnt_a">\n\
                            <option selected value="K">KABEL</option>\n\
                            <option value="W">WLAN</option>\n\
                            <option value="V">VPN</option>\n\
                        </select>\n\
                        </label>\n\
                    </p>').appendTo(scntDiv);
                    i++;
                }

                if(i > 3 ){
                    $('#showaddmac').hide();
                }
                return false;
            });

            $('#remScnt').live('click', function() {
                if( i > 2 ) {
                        $(this).parents('p').remove();
                        i--;
                }
                if(i < 4 ){
                    $('#showaddmac').show();
                }
                return false;
            });
        });
    </script>

this works with out problemes, but the new fields will be not transformed. Does anyone know a solution to the problem?

Sry for my bad english :)

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jqtransform