Set default value based on another field

Ricardo Silva

New member
Hello,

Is it possible to set the default value of a field based on a value filled on another field, For example, in a form the default value of some fields would be set depending on the selected value from a drop down list. I created a custom function but can't make it work. Could someone provide an example how build it?

Thank you.
 

Edwin

New member
Imagine you choose from a drop down list the Customer to create a quotation. As soon as the Customer has been choosen you want to fill in some fields from that Customer record automatically in the Quotation form.

You could use the Ajax XMLHttpRequest

Custom Java script

1715249682400.png

With the 'get_salesquote_info(data)' I am picking up other data automatically from other tables in the same routine.

DB Connection

1715250488698.png

Custom PHP script

1715249827315.png

In the Forms configurator (Field Company Id on the Sales Quotation form)

1715250034101.png

Hope this helps you out :)

And by the way, I am not a professional in coding at all. So if this is all written in the most optimal way I am not sure about but it works absolutely fine. Mostly Google did help me out with this.
 
Last edited:
Top