function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dsh210@lehigh.edudsh210@lehigh.edu 

Run update on field change

Hey All,

 

So I am currently facing an issue here. I have a picklist that controls what attribute type a new attribute will be. Each attribute type has different parameters for the user to set. The way my page is currently set up, the user has to select a different type, then click an update button to get the page to refresh with the new options (by running an 'update' command in APEX). Is there any way I can get it to run the update using an "onChange" element? I tried several different ways but always got an error.

 

onChange="{!Updates}" with an Apex method getUpdates() gave a server crash.

onChange="updatesScript()" with the same Apex and a javascript method calling {!Updates} gave me a DML not supported error.

 

I read that I cannot use DML inside a getter. However, if I change the method to just Updates(), my visualforce page cannot see it and I get the error that the method doesn't exist in the controllers (it's obviously still looking for the get).

 

Does anyone know how I can get this page to update when I change that field?

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
mtbclimbermtbclimber

Yes. Check out the actionSupport component and/or actionFunction.  Here's an example of what I think you're trying to do using actionSupport:

 

http://wiki.developerforce.com/index.php/Visualforce_DynamicEditPage