Dropdown with articles and automatic price

amax 6d ago

Hi everyone,I’m working on a form in Chronoforms and I have a question:

  • I have a dropdown field with a list of 16 articles;

  • I would like the price field to be filled automatically with the corresponding value when an article is selected.

My question is:do I need to create 16 different price fields, or is there a simpler way to link each dropdown option to its price and display it automatically?

Thanks in advance!

Max_admin 5d ago
Answer

Hi amax

You can add a trigger when the first dropdown changes, and on the 2nd dropdown you need to add an advanced listener, which can have any of these:

  1. Call Function, in your function you can set the value of the Price field to whatever you want.
  2. AJAX Call, the 2nd parameter to the AJAX can be a function name which will receive the AJAX response, the response can be the price you need, in your AJAX page you can run some PHP or Read Data to get the price and "echo" it

You can also have 16 triggers and 16 listeners, 1 for each article

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
amax 4d ago

Thanks, but I tried and I can’t manage. Could you give me a practical example?

In the field where the prices are, the value is of type text and read-only.

Thanks, amax

You need to login to be able to post a reply.