You need to sign in to do that
Don't have an account?

Help on JQuery
Hi - Thanks for the providing neat and clear solution on the validation. I am trying this and having some road blocks. Can some one please address where the issue is?
This is the one i am trying.
I am receiving error: Static Resource named jquery does not exist. Check spelling
and sometimes
unexpected token: '' unexpected token: '<EOF>'at line 0 column -1.
here is my id value for vendor_meet j_id0:j_id1:j_id2:j_id63: Validation Error: Value is required.
Please advise.Thanks
<apex:page controller="My_Controller" showHeader="false" standardStylesheets="false"> <apex:includeScript value="{!$Resource.jquery}"/> <apex:includeScript value="http://ajax.microsoft.com/ajax/jquery.validate/1.6/jquery.validate.min.js"/> <script type="text/javascript"> $(document).ready(function() { $(jq(f)).validate(); $(jq(vendor_meet)).rules("add",{ required: true }); jQuery.validator.messages.required = "Please enter a value"; jQuery.validator.messages.equalTo = "You have to enter a value. Please!!!"; }); </script> <apex:form id="commentForm" > <script> var vendor_meet = "{!$Component.vendor_meet}"; </script> <apex:outputlabel for="vendor_meet">Vendor (required)</apex:outputlabel> <apex:inputText id="vendor_meet" value="{!Vendor_Meetings}"/> <apex:commandButton action="{!save}" value="Save"/> </apex:form> <script> function jq(myid) { return '#' + myid.replace(/(:|\.)/g,'\\\\$1'); } var f = "{!$Component.commentForm}"; </script> </apex:page>
Hi- any info on this?
Looks like issue is with $. I included jQuery.noConflict();
but still experiencing the issue..please advise
please help!!!!!
we downloaded jquery plugin from http://plugins.jquery.com/project/validate. And created a static resource named jquery.
Now the error message has gone. But when form is submitted validation is not being performed.
Please advise.
<apex:page showHeader="false" standardStylesheets="false" controller="MyController"> <apex:includeScript value="{!$Resource.jquery}"/> <apex:includeScript value="http://ajax.microsoft.com/ajax/jquery.validate/1.6/jquery.validate.min.js"/> <script type="text/javascript"> jQuery.noConflict(); $(document).ready(function() { $(jq(f)).validate(); $(jq(ven_meet)).rules("add",{required: true, minlength: 2}); jQuery.validator.messages.equalTo = "You have to enter a value. Please!!!"; jQuery.validator.messages.required = "You better have entered a value.. or else!"; }); </script> <apex:form id="commentForm" > <script> var ven_meet = "{!$Component.ven_meet}"; </script> <apex:outputlabel for="ven_meet">Vendor: </apex:outputlabel> <apex:inputText id="ven_meet" value="{!vendor_meetings}"/> <apex:commandButton action="{!save}" value="Save" /> </apex:form> <script> function jq(myid) { return '#' + myid.replace(/(:|\.)/g,'\\\\$1'); } var f = "{!$Component.commentForm}"; </script> </apex:page> ---------------------------------------------------------- public with sharing class MyController { public string Vendor_Meetings { get;set; } public PageReference save() { System.debug('Hi'); return null; } }
has this problem solved already?
Try...
var j$ = jQuery.noConflict();
Then use j$ instead of $ to avoid conflicts with Salesforce javascript.
HTH
It Looks, there is some issue with while configuring Jquery in your VF page
check out this http://www.tehnrd.com/setting-up-jquery-with-salesforce-com/#more-454
hope this will help you
Thanks,
Bala