- Home
- Technical Library
- Boards
- Cookbook
- Code Share
- Blogs
- Partners
-
More
-
Services
- Training & Certification
- Support
-
Galleries
- Force.com Sites Gallery
- Chatter Challenge Entries
-
Other Web Sites
- Salesforce.com
- Database.com
- AppExchange
- CRM Community
-
Discussions
- Announcements
- General Development
- Schema Development
- New to Cloud Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules Discussion
- Security
- Mobile
- Force.com Sites
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby Development
- Adobe Flash Builder for Force.com
- Desktop Integration
- REST API Integration
- Streaming API
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- Excel Connector
- AJAX Toolkit & S-controls
- Force.com Builder & Native Apps
- AppExchange Directory & Packaging
- Force.com Labs Projects
- Open Source
- Site.com
- Jobs Board - Administrators
- Jobs Board - Developers
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Mobile
- :
- Re: can't be able to pass the vf components id to ...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
can't be able to pass the vf components id to jquery
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-08-2012 11:09 PM - last edited on 02-09-2012 08:49 PM
hi all ,
I am quite new to salesforce . i am just creating a mobile app that can just manage accounts and Related contacts.
basically i want to add a functionality in my app such that user can be able to create new account by giving their desired value in the form .
now whne i use html tags like <input id="website" name="website" type="text" /> . jquery process that id easily.
viz var website=$j('#website').val();
but when i try to use <apex:inputfield id="website" value="acc.website"> or <apex:inputtext id="website" value="{!website}"/>
where website is defined in controller with proper getter and setter method.
so as to engaage salesforce field . the error arises that this tag can only be used with sfobjects.
can anyone help me out in passing any vf components id to jquery and retrieve that value in jquery .
any help in this regard would be much appreciated .
-----------------
Thanks and Regards
Anchal Garg
anchal56.er@gmail.com
Solved! Go to Solution.
Re: can't be able to pass the vf components id to jquery
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-10-2012 10:06 AM
Hi Anchal
Try this for your account name input box
$(document.getElementById('j_id0:fm:accountname'))
Let me know if you still have problem.
With Best
Kc
Re: can't be able to pass the vf components id to jquery
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-12-2012 09:45 PM
Hi Kapil ,
Thanks for your reply. This code snippet does the same thing as I require.
$(document.getElementById('j_id0:fm:accountname'))
can you clear my doubt in your code
what's this j-id0 :fm: stands here ??
I also sort this problem out by using this code
var accountname=$j('input[id*="accountname"]').val();
Re: can't be able to pass the vf components id to jquery
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-14-2012 08:18 PM
Anchal
" j-id0 :fm:" is salesforce generated Id's. Whenever you write something like <apex:inputfield value="{!any}"/>. Here you don't set any id for inputfield so when the apex page will render salesforce gives a unique id to it. like j_id0 or j_id1 and it'll always same untill you will not insert any extra element (apex:outputpanel or any ape tag). Format of the id is always like this. Pageid:formid:apx_element1:apex_element2. Suppose you created a page like this.
<apex:page id="pg">
<apex:form id="frm">
<apex:outputpanel id="opPanel" layout="block">
Test Div
</apex:outputpanel>
<apex:form>
</ape:page>
your div's id will be "pg:frm:opPanel"
Jquery don't allow ":" in id's so it's not able to find id's in salesforce format. For jqury you have to write $(document.getElementById('pg:frm:opPanel'));
[If you got answer from my post please mark it as solution.]
Thanks,
Kc
Re: can't be able to pass the vf components id to jquery
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-14-2012 08:33 PM
Thanks kapil for clearing the doubt.... :)

