• edgarM
  • NEWBIE
  • 35 Points
  • Member since 2009

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies

I have an apex command button as below calling a custom controller method

 

<apex:commandButton value="Save" id="Save" action="{!save}" onclick="this.disabled=true;"/>

 

The method saves the item and navigate to another page. It is not a partial page update call.

 

I would like to disable button after the first click. I tried using onclick and calling a javascript to set the disabled status as true. When I use onclick even to make the javascript call, the button becomes disabled, but the save method on the controller is not being called.

 

I changed the button onclick event  to just alert 'hi' as below and it works. It alerts and then also makes the method call

 

<apex:commandButton value="Save" id="Save" action="{!save}" onclick="alert('hi');"/> 

 

But when I added the code to disable the button too as shown below, it stops calling the controller method.

 

<apex:commandButton value="Add Item(s)" id="addItem" action="{!addItems}" onclick="alert('hi');this.disabled=true;"/>

 

Is there a different way to solve this?

Message Edited by DCS on 05-07-2009 02:03 PM
  • May 07, 2009
  • Like
  • 0

Hello,

I tried to access the CustomerPortal in Enterprise Edition Org, but I can not see the option of Customer Portal, how active this option?

  • April 05, 2010
  • Like
  • 0

Hi.

 

I'm triying merge two accounts from a trigger but this throw a Exception: System.SObjectException: DML statment cannot operate on trigger.new or trigger.old, this is the code.

 

 

public class mergeSample { public void convinaCuenta(Account[] cuentas) { for(Account cuenta:cuentas) { //This account already exist Account cuentahija=new Account(Id='0018000000YliZZ');

  //Try to merge accounts

merge cuenta cuentahija; } } }

 

 

 

i hope every one can help me, thank.
  • October 07, 2009
  • Like
  • 0

Hi.

 

I'm triying merge two accounts from a trigger but this throw a Exception: System.SObjectException: DML statment cannot operate on trigger.new or trigger.old, this is the code.

 

 

public class mergeSample { public void convinaCuenta(Account[] cuentas) { for(Account cuenta:cuentas) { //This account already exist Account cuentahija=new Account(Id='0018000000YliZZ');

  //Try to merge accounts

merge cuenta cuentahija; } } }

 

 

 

i hope every one can help me, thank.
  • October 07, 2009
  • Like
  • 0

Can i override account "save" button using Visualforce . 

My visualforce page only executes javascript that queries information from account detail page and creates task

 

 

I am using Professional edition

 

 

 

I have an apex command button as below calling a custom controller method

 

<apex:commandButton value="Save" id="Save" action="{!save}" onclick="this.disabled=true;"/>

 

The method saves the item and navigate to another page. It is not a partial page update call.

 

I would like to disable button after the first click. I tried using onclick and calling a javascript to set the disabled status as true. When I use onclick even to make the javascript call, the button becomes disabled, but the save method on the controller is not being called.

 

I changed the button onclick event  to just alert 'hi' as below and it works. It alerts and then also makes the method call

 

<apex:commandButton value="Save" id="Save" action="{!save}" onclick="alert('hi');"/> 

 

But when I added the code to disable the button too as shown below, it stops calling the controller method.

 

<apex:commandButton value="Add Item(s)" id="addItem" action="{!addItems}" onclick="alert('hi');this.disabled=true;"/>

 

Is there a different way to solve this?

Message Edited by DCS on 05-07-2009 02:03 PM
  • May 07, 2009
  • Like
  • 0