+ Start a Discussion
krish99krish99 

HOW TO ENABLE THE JAVASCRIPT BUTTON

Hi,
           i am using button when i click on it means it is disabling after some time how can i  enable the button automatically

       2. When page reloads means how button automatically enable

Yoganand GadekarYoganand Gadekar

IS it on standard page? then it will depend on your page layour

if it is on visualforce page then you need to see if it has has been disabled by any boolean variable...

krish99krish99

it is in visualforce page.

 

 once i click on the  button it will be disable state.

After some specified button should be automatically enable.

how can i achieve this..

Yoganand GadekarYoganand Gadekar

You can use "disabled" attribute of command button to enable or disable it by binding a boolean varibale ot it...  Hit kudos and mark as answer if it helps you.

krish99krish99

Can U send me some sample code..

Sridhar VenkateswaraluSridhar Venkateswaralu

sample code:

 

VF Page:

<apex:page controller="vfpage3" >
<apex:form id="formid">
<apex:actionFunction name="enableagain" action="{!enable}" reRender="formid"/>
<apex:commandButton id="cmdId" value="submit" disabled="{!disabled}" action="{!disable}" reRender="formid" oncomplete="alert('enableagain');enableagain()"/>
</apex:form>
</apex:page>

 

 

Apex controller:

public class vfpage3 {

public vfpage3 (){
disabled = false;
}
public boolean disabled{get;set;}
public void enable(){
disabled = false;

//task to be performed on button click
/*****

***/
}

public void disable(){
disabled = true;
}
}