OK, so it might just be that I've been working on learning Chronoforms for a while and my brain is just addled, but I can't seem to get this to work. Let me try to explain this as coherently as possible...
I am attempting to make a form for a friend of mine to use as a character creation page on his website. I'm making a multi-page form, and am doing ... so-so overall in getting the form running. Where I'm currently stuck is attempting the following: On page 2, I have three drop-down lists that are pulling their options from another database. These drop-down lists are "Tier 1 title", "Tier 2 title", and "Tier 3 title". That part is working fine, so far.
Now, on page 3 (this is on a separate page instead of just being handled by an AJAX function because ... well, because I'm trying to learn PHP/JavaScript as I go, and I'm not yet fluent enough to work with AJAX calls in a system that I'm already unfamiliar with :-P) I have another drop down, which is intended to let the user pick one of the three previously-chosen titles to use for its accompanying trait.
What I am having problems doing is getting the information for the three previous drop-downs' selections to be available as data in the new drop-down.
The three 'tier title' drop down's field names are t1title, t2title, and t3title. I've tried listing them as [t1title]=[t1title], etc, in the options. I've also tried using {} braces instead of []. I've attempted to write custom code to load the data from $form->data[t1title] into a variable named $trait1 and displaying that as $trait1 = $trait1 in the options, and that has also not worked. I'm pretty sure that, whatever it is I'm doing wrong, it's probably something ridiculously simple... I just can't seem to figure it out.
Oh, I've also tried saving the form data to the mysql database, and then using a DB record loader action to retrieve those three values, but I have them stored in separate fields, and I'm not sure how to/if you can combine those three fields into one model that I can use to populate a single drop-down.
Any help that someone can offer would be much appreciated.
I am attempting to make a form for a friend of mine to use as a character creation page on his website. I'm making a multi-page form, and am doing ... so-so overall in getting the form running. Where I'm currently stuck is attempting the following: On page 2, I have three drop-down lists that are pulling their options from another database. These drop-down lists are "Tier 1 title", "Tier 2 title", and "Tier 3 title". That part is working fine, so far.
Now, on page 3 (this is on a separate page instead of just being handled by an AJAX function because ... well, because I'm trying to learn PHP/JavaScript as I go, and I'm not yet fluent enough to work with AJAX calls in a system that I'm already unfamiliar with :-P) I have another drop down, which is intended to let the user pick one of the three previously-chosen titles to use for its accompanying trait.
What I am having problems doing is getting the information for the three previous drop-downs' selections to be available as data in the new drop-down.
The three 'tier title' drop down's field names are t1title, t2title, and t3title. I've tried listing them as [t1title]=[t1title], etc, in the options. I've also tried using {} braces instead of []. I've attempted to write custom code to load the data from $form->data[t1title] into a variable named $trait1 and displaying that as $trait1 = $trait1 in the options, and that has also not worked. I'm pretty sure that, whatever it is I'm doing wrong, it's probably something ridiculously simple... I just can't seem to figure it out.
Oh, I've also tried saving the form data to the mysql database, and then using a DB record loader action to retrieve those three values, but I have them stored in separate fields, and I'm not sure how to/if you can combine those three fields into one model that I can use to populate a single drop-down.
Any help that someone can offer would be much appreciated.
Hi durmiun,
I think that the most straightforward way to do this is to use the Dynamic Data options on the Select DropDown element. To work with this you need to have your data organised like this in the $form->data array:
Here 'data_path', 'value' and 'text' can be any convenient strings - they need to be entered in the Dynamic Date tab of the drop-down.
For your data the code to set this up might look like:
Bob
Bob
I think that the most straightforward way to do this is to use the Dynamic Data options on the Select DropDown element. To work with this you need to have your data organised like this in the $form->data array:
['data path']
[0]
['value'] = 'value 0'
['text'] = 'text 0'
[1]
['value'] = 'value 1'
['text'] = 'text 1'
[2]
['value'] = 'value 2'
['text'] = 'text 2'
. . . and so on
Here 'data_path', 'value' and 'text' can be any convenient strings - they need to be entered in the Dynamic Date tab of the drop-down.
For your data the code to set this up might look like:
<?php
$form->data['tiers'][0]['value'] = $form->data['t1title'];
$form->data['tiers'][0]['text'] = $form->data['t1title'];
$form->data['tiers'][1]['value'] = $form->data['t2title'];
$form->data['tiers'][1]['text'] = $form->data['t2title'];
$form->data['tiers'][2]['value'] = $form->data['t3title'];
$form->data['tiers'][2]['text'] = $form->data['t3title'];
?>
Then you'd put tiers, value and text in the Dynamic Data boxes.Bob
Bob
This topic is locked and no more replies can be posted.