tooltip validation

Hi,

I'm trying to validate my form, I need to put the message in the tooltip and change the default message.

this is what I have so far.

Thanks,
Lulu


<script type="text/javascript" src="Script/jquery.validation.js"></script> 

                                 $(document).ready(function () {

	$("#SubmitFormImg").click(function () {	
		$("#UnitTestingFrm")
    .validate({
        rules: {
            CQTicket: "required"
        },
        messages: {
            CQTicket: "required field"
		}
    });







});

</script>

 <span class="required-field" style="width:10%;">
    		<input type="text" name="CQTicket" id="CQTicket" style="color:#555555;" />		
                  </span>



// I just want to say "Required" instead of the default message and I would like it to be in a tooltip.
// but I am not sure how to do it.

Open in new window

lulu50Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lulu50Author Commented:
ANY HELP ON HOW TO CHANGE THE DEFAULT MESSAGE?
0
dgrafxCommented:
well to change the default message then it's just a matter of changing "required field" to "Required".
that's under messages for that field like so:
messages: {
            CQTicket: "Required"
            }

but the second part which is to change to a tooltip instead of an error display like the jquery validation plugin - I am not sure ??? but I do think that you'd be better off starting with something other than the jquery validation plugin.
for example you could do something simple like onsubmit set the title of the field in question via javascript to "Required" if it was left empty and a zero length string if it was not.
0
dejaanbuCommented:
you can use jquery ui 's tooltip() function to display tooltip. To use tooltip() together with jquery's validate plugin, u can use errorPlacement callback.
$("#SubmitFormImg").click(function () {	
		$("#UnitTestingFrm")
    .validate({
        rules: {
            CQTicket: "required"
        },
        messages: {
            CQTicket: "Required"
		},
errorPlacement: function(error, element) 
    {
        element.attr('title', error.text());
        $(".error").tooltip(
        {   
            position: 
            {
                my: "left+5 center",
                at: "right center"
            },
            tooltipClass: "ttError"
        }); 
 }
    });

   

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lulu50Author Commented:
Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.