You need to sign in to do that
Don't have an account?
ravikanth321
Disabling Both Top and Bottom Buttons Of PageBlockButtons During OnClick Event.
Hi I am Using Page Block Buttons Instead Of CommandButtons To Dispaly Buttons On Both Top and Bottom,I Have a Requirement where I have to Disable Button OnClick ,So We Can avoid Multiple Submissions.I Tried With PageBlock Buttons Disabling Is Working Fine But Onclick If any Button Either Top or Buttom i have to Disable Booth Buttoms...Any Ideas Plz...??? TIA.
<apex:pageBlock title="Test" id="pgblk">
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton action="{!cancel}" value="Cancel"/>
<!--<apex:commandButton value="Convert" id="Convert" action="{!convertLeadFunction}" />-->
<apex:commandButton value="Convert" action="{!convertLeadFunction}" onclick="disable" reRender="pgblk"/>
<!--<apex:commandButton value="Convert" action="{!convertLeadFunction}" onclick="alert('Please Wait Until Lead Gets Converted');" /> -->
<!--<apex:actionStatus id="saveStatus">
<apex:facet name="stop">
<apex:commandButton value="Convert" action="{!convertLeadFunction}" status="saveStatus" rerender="saveParentBlock" />
</apex:facet>
<apex:facet name="start">
<apex:commandButton value="Please Wait While Converting" disabled="true" status="saveStatus" rerender="saveParentBlock" />
</apex:facet>
</apex:actionStatus> -->
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock title="Test" id="pgblk">
<apex:pageMessages />
<apex:pageBlockButtons >
<apex:commandButton action="{!cancel}" value="Cancel"/>
<!--<apex:commandButton value="Convert" id="Convert" action="{!convertLeadFunction}" />-->
<apex:commandButton value="Convert" action="{!convertLeadFunction}" onclick="disable" reRender="pgblk"/>
<!--<apex:commandButton value="Convert" action="{!convertLeadFunction}" onclick="alert('Please Wait Until Lead Gets Converted');" /> -->
<!--<apex:actionStatus id="saveStatus">
<apex:facet name="stop">
<apex:commandButton value="Convert" action="{!convertLeadFunction}" status="saveStatus" rerender="saveParentBlock" />
</apex:facet>
<apex:facet name="start">
<apex:commandButton value="Please Wait While Converting" disabled="true" status="saveStatus" rerender="saveParentBlock" />
</apex:facet>
</apex:actionStatus> -->
</apex:pageBlockButtons>
</apex:pageBlock>
Best way to achieve this is through javascript. Take a look at the below extract of your code. I have updated it with javascript logic using jQuery:
The summary of the fix is as follows:
1. Set a styeclass to each of the buttons so that it provides a handle for accessing them from within javascript/jQuery.
2. Write a javascript function to handle button disable operation.
3. In each of the buttons, onclick invoke the javascript function.
Do note that the code is draft and I haven't tried compiling/running. But I certainly hope it guides you in the right direction.
All Answers
Hey i wrote some code to disable the button on the onclick event using the boolean variable and here is the snippet.
Please let me know if you need any other help.
Thanks,
pRAMODH.
Best way to achieve this is through javascript. Take a look at the below extract of your code. I have updated it with javascript logic using jQuery:
The summary of the fix is as follows:
1. Set a styeclass to each of the buttons so that it provides a handle for accessing them from within javascript/jQuery.
2. Write a javascript function to handle button disable operation.
3. In each of the buttons, onclick invoke the javascript function.
Do note that the code is draft and I haven't tried compiling/running. But I certainly hope it guides you in the right direction.
Like Below. On Click Of Either Top Or Bottom "Convert" Button ,Both Buttons must Diasabled "Convert " Buutton and Should Show This Message "Please Wait While Converting"
On That Disabled Buttons
There is a new entry at line 6 to show user message.