Skip to main content

Posts

Showing posts from 2016

Useful References

SELECT/PICKLIST Options http://christopheralunlewis.blogspot.com/2010/10/creating-picklist-in-visualforce-page.html http://sfdcsrini.blogspot.com/2014/07/how-to-use-apexselectoptions-and.html FLOW https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_flows_advanced.htm https://developer.salesforce.com/blogs/developer-relations/2013/08/setting-field-focus-in-visual-workflow.html https://developer.salesforce.com/blogs/developer-relations/2011/10/dynamic-visualforce-and-visual-workflow-with-rerender.html AJAX http://www.jitendrazaa.com/blog/webtech/salesforce-tutorial-create-simple-ajax-based-visualforce-page/ https://developer.salesforce.com/docs/atlas.en-us.ajax.meta/ajax/sforce_api_ajax_vf_sample.htm BATCH APEX http://developer.force.com/cookbook/recipe/using-batch-apex-to-reassign-account-owners E-MAIL http://www.sfdc99.com/2014/03/01/sending-emails-using-apex/ https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_forcecom...

VisualForce Best Practices

Accessing component IDs When we refer Visualforce  components in JavaScript, the ID attribute plays a major role. Every Visualforce component has an ID attribute. The ID attribute must be specified to a particular component in order to refer to it in JavaScript and it is used to bind the two components together. When the page is rendered, this ID attribute is a part of DOM ID of the particular component. The ID attribute must be unique as well. The following best practices are applied for accessing component IDs: Use the  $Component  global variable  to simplify access. For an example, when we have an input field with  id="inputOne"  within a page block with  id="blockOne" , we can access the input field with the $Component.blockOne.inputOne  expression. No need to  specify an ID for a component you want to access if it is an ancestor or sibling to the $Component  variable in the Visualforce component's hierarchy. ...

TIPS and Tricks

If we don't  use an  id  attribute for a particular component,  Visualforce uses a dynamically-generated  id , for example,  j_id0, j_id0:j_id1 . Consider an example, we have specified the id  attribute for  <apex:inputField id="inputOne"/> . But we haven't specified any  id  attribute for parent components of  inputOne . We can select such a component using jQuery. It is called partial selectors.For example:  j$('[id*= inputOne]') < apex: page docType = " html-5.0 " > <!-- HTML5 --> </ apex: page > < apex: page docType = " html-4.0.1-transitional " > <!-- HTML 4.0.1 Transitional --> </ apex: page > < apex: page docType = " xhtml-5.0.1-strict " > <!-- XHTML 5.0.1 Strict--> </ apex: page > The component markup is same as other Visualforce pages. It can be a combination of Visualforce and HTML tags. We can also add customized CSS and JavaScript. All the  ma...