Skip to main content
August 30, 2010
Question

Coldfusion with jquery

  • August 30, 2010
  • 1 reply
  • 854 views

I have facing one proble in jquery and coldfusion.

I have one select box on toggleing of tht select i populated some feils and hide  some another feid.The problem is tht whn i submit it asking to fill tht hidden feilds.I tried to change the required attrbute of tht feilds to false and true for new visbile feilds in jquery but not succedded in my way..i can change other attribute like disable and all but "required " is not getting..

any one please help?

<cftextarea name="comments"

                                              

                                                id="rationale"

                                                rows="5"

                                                cols="60"

                                               

                                                message="Please enter a response for comments">

                                                #comments#

                                    </cftextarea>

<script type="text/javascript">

    

jQuery(document).ready(function(){

           

            $("#comments").rules("add", {

             required: true,

            minlength: 2,

            messages: {

             required: "Required input",

             minlength: jQuery.format("Please, at least {0} characters are necessary")

            }

            });

           

});

</script>

Any workaround for this?

    This topic has been closed for replies.

    1 reply

    August 30, 2010

    below is the code i used

    <cftextarea name="comments"

                                                  

                                                    id="comments"

                                                    rows="5"

                                                    cols="60"

                                                   

                                                    message="Please enter a response for comments">

                                                    #comments#

                                        </cftextarea>

    <script type="text/javascript">

        

    jQuery(document).ready(function(){

               

                $("#comments").rules("add", {

                 required: true,

                minlength: 2,

                messages: {

                 required: "Required input",

                 minlength: jQuery.format("Please, at least {0} characters are necessary")

                }

                });

               

    });

    </script>

    August 30, 2010

    Whats the html being produced by the cftextarea tag?  Are you sure the id "comments" is unique?  Also don't get in to the habit of naming and id'ing your form tags the same.  Does the jquery selector work with something basic, like setting a style?

    If you head over to the jQuery forums, with the html that is being produced they will be able to help too.

    Cheers

    August 31, 2010

    I am tring to change the attribute value through jquery

    <cfinput type="text" name="txtname" id="txtid" required="false">

    I need to change the required attribute while selecting one select box.I using jquery for tht.

    Is there any way to change requierd attri through jquery?

    Please help