function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mavsmavs 

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>

 

 

 

Message Edited by mavs on 03-17-2010 08:51 AM
Message Edited by mavs on 03-17-2010 08:52 AM
Message Edited by mavs on 03-17-2010 02:39 PM
Message Edited by mavs on 03-17-2010 06:38 PM
mavsmavs

Hi- any info on this?

 

Looks like issue is with $. I included jQuery.noConflict();

 

but still experiencing the issue..please advise

Message Edited by mavs on 03-17-2010 02:45 PM
mavsmavs

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; } }

 

Message Edited by mavs on 03-18-2010 01:58 PM
prettynerdprettynerd

has this problem solved already?

Ron WildRon Wild

 

Try...

 

var j$ = jQuery.noConflict();

 

Then use j$ instead of $ to avoid conflicts with Salesforce javascript.

 

HTH

 

b-Forceb-Force

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