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
rtandon17@gmail.comrtandon17@gmail.com 

Real time or dynamic calculation of field value based in visual force page

Hi,

I have a requirement where in I have table with 6 fields. The first 5 fields are picklist and sixth one needs to be calculated and should contain the result.

Now ,the user can select any values from each of the 5 picklists and based on the selection of values from the picklist , I will need to perform some numeric calculation and display the numerica value in the 6th field on the fly.

 

Currently my sixth field is a formula field , but the issue is , that formula field calculates and displays only after clicking on the save; Whereas my requirement is that the user  can see the change in the value of the 6th field on the fly as and when the user selects or changes the value in any of the first 5 picklist fields.

 

 

Please help!

Any complete sample code or javascript is appreciated. Thank you!

SeAlVaSeAlVa

You have several options, some of them are the following

 

You can

- replicate trigger logic using javascript [pretty fast]

- replicate trigger logic using apex and rerender the table values [will take time to rerender]

- if you don't have any auto-number you can insert the values needed to calculate the formula, then query the calculated formula field, and then perform a database.rollback (pretty ugly, botched job, but might work). [will take time to reRender and might take longer than the 2nd option]

 

Regards.

rtandon17@gmail.comrtandon17@gmail.com

Any Sample code pls?