Forums

Output from database to show in a form

Siemi 08 Oct, 2013
I am in te process of updating my website. The main issue is to step up from Chronocontact 2.5 to the latest Chronoforms. So far, things are going quite well (apart from the bruises on my head from banging the wall 🤣 ). It has taken me so much more effort then I expected to recreate my old form in Chronoform. I think I start to understand the way it works now, but the issue I can't seem to resolve is presenting output different then a pull down menu. Yes, I expect it to be easy, but I can't figure it out.

Basically, if you go to http://usa-boot-import[dot]nl/bpm/jupgrade/index.php?option=com_chronoforms&tmpl=component&chronoform=calculator
(don't forget to replace [dot] with .) and the merk, type and uitvoering is filled in, the pulldown standaard gets populated with data from the database based on the earlier selections. However, I would like to show the output in like:

Elektrische ramen voor, Getint glas, Hoofdsteunen achter, Verstelbare stuurkolom

instead of a pull down field. In my current old site a div gets updated with javascript
<div id="ctlStandaard"> Elektrische ramen voor, Getint glas, Hoofdsteunen achter, Verstelbare stuurkolom</div>


How can I do this? I think the problem is that the data to populate into the pull down menu is in php and it needs to be brought into the javascript so it can update with a LOAD_JS like:
//      $('standaard_output').value = "HELLO WORLD";
$('standaard_output').value (standaard_array)

With the commented out "Hello World", it shows hello world in the designated text box, but I can seem to make it work with the data it should use. The load_js is currently on the onload, since when I put it in the ajax event, it doesn't show.

I'm stuck on this for 5 days now :-(
GreyHead 08 Oct, 2013
Hi siemi,

I think that you have a couple of choices here.

One: would be to hand-code the last Ajax look up instead of using the built-in code in ChronoForms. You can copy the script in the page source and then edit the OnSuccess: part to do something different with the returned data - like add it to a span as a comma separated list.

Two: would be to leave the Ajax code as it is but use JavaScript to grab the options from the Standaard drop-down and re-display them.

I would probably do 'One' and may be even hand-code the Ajax PHP in a separate event to pass back the information in a more useful format.

Bob
Siemi 09 Oct, 2013
When you know how its done, it is sooooo easy. I took the generated javascript code for the pull down menu, altered it to the field names of the div. Put it in the load_js which is in on_load and thats it. Can't believe I couldn't figure that out before..... 😶
This topic is locked and no more replies can be posted.