Browse Month: October 2015

Lightning Pages vs VF Pages

Lightning is available in GA from this release .You can ofcourse approach via lightning .Some of the things you need to be extra careful are here

1)No router support in lightning yet and hence its extremely difficult designing navigation at this point .You will end up writing lot of code just to achieve navigations

2)Custom lookups you can get from developerforce blogs

3)Toggling visibility is not so difficult

4)Supporting jquery in lightning is possible but you need to be careful when using this and would recommend to use less as possible

5)Spinning a list is not so difficult with excellent repeater .

6)Currently to make experience seamless lightning expereince also needs to be turned on for all your users .

Since there will be additional learning and experimenting take decision based on budget and time lines .

Building in lightning is like giving awesome quality work with lot of resusable at cost of little more time .

‘Immediate’ attribute for commandbutton and commandlink in VF page

This is basically used when we don’t want our validation rules to be fired during any server request.
It is a Boolean value that specifies whether the action associated with this component should happen immediately, without processing any validation rules associated with the fields on the page. If set to true, the action happens immediately and validation rules are skipped. If not specified, this value defaults to false.
We generally use it to make functionality of ‘Cancel’ button or ‘Back to Page’ button, where we don’t want validation rule to get executed. If we don’t use immediate=true then on click of cancel button also, validation rules will get executed.

—————————————— VF Page ————————————————-

<apex:form >
      <apex:pageBlock >
      <apex:pageBlockButtons location="both">
                  <apex:commandButton value="Save" action="{!saveAccount}"/>
                  <apex:commandButton value="Cancel" immediate="true" action="{!cancelPage}"/>
      </apex:pageBlockButtons>
      <apex:pageBlockSection >
             <apex:inputField value="{!account.name}"/>
             <apex:inputfield value="{!account.Type}" required="true"/>
      </apex:pageBlockSection>
      <apex:outputText value="Account Added" rendered="{!isAdded}"/>
      <apex:outputText value="Account Not Added" rendered="{!isCancel}"/>
      </apex:pageBlock>
 </apex:form>

—————————————– Controller ———————————

public with sharing class AccountExtension {
public Boolean isAdded{get;set;}
public Boolean isCancel{get;set;}
public AccountExtension(ApexPages.StandardController controller) {
isAdded = false;
isCancel = false;
}
public pagereference cancelPage(){
isAdded = false;
isCancel = true;
return null;
}

public pagereference saveAccount(){
isAdded = true;
isCancel = false;
return null;
}
}