I'm using Javascript to get the value of the "id" in the DB from the radio buttons as follows
My HTML has the following
This works great but I would like to grab other fields from the database based on the radio button selections. DB fields "introtext", "alias" and "urls" Here is a form view -

Can I do this with Javascript or do I need to have another read action to be able to get these fields?
var a = jQuery("input[name='discount']:checked").val();
document.getElementById("discount_giftcard").innerHTML = a;
var b = jQuery("input[name='portal']:checked").val();
document.getElementById("discount_portal").innerHTML = b;
My HTML has the following
<h4>Discount Gift Cards "id"</h4>
<p id="discount_giftcard"></p>
<h4>Cashback Portal "id"</h4>
<p id="discount_portal"></p>
This works great but I would like to grab other fields from the database based on the radio button selections. DB fields "introtext", "alias" and "urls" Here is a form view -

Can I do this with Javascript or do I need to have another read action to be able to get these fields?
Unless you already have that data loaded and somewhere on your form, you'll need to re-read.
Can I do a single read event to get all the fields that I need from the database and then grab them based on the id value of the radio buttons?
or do I need to do separate read events for each field? I just don't know which way is a more efficient way of going about it
or do I need to do separate read events for each field? I just don't know which way is a more efficient way of going about it
Just reload the fields and re-read the database, makes more sense than loading all the data every single time and trying to use JQuery to filter it out and rebuild options.
Ok, I've got a read action "read_data15" producing two options for a radio group. I also set up another read action "read_data17" to list different fields from the database as you can see below.

If I were to select the "id" 9568 from the radio group in "read_data15" how can I display the corresponding "alias" that has the same "id" from the "read_data17"?
Or is there another way to get the "alias" in the first read event "read_data15"? I tried adding additional fields but I'm not sure how to do that with a radio group

If I were to select the "id" 9568 from the radio group in "read_data15" how can I display the corresponding "alias" that has the same "id" from the "read_data17"?
Or is there another way to get the "alias" in the first read event "read_data15"? I tried adding additional fields but I'm not sure how to do that with a radio group
Look at the dynamic dropdown demo form.
I've studied the dynamic dropdown demo but I'm getting nowhere... Not sure how this is used for what I'm trying to do
The first dropdown should reload the other field, and in the reload event read the database based on {data:first_field}
Which part of the dynamic dropdown demo are you stuck on? Because it definitely sounds like what you need. You want the user to select an option, and then displays to them an entry from the database based on what they've selected.
That is precisely what I'm trying to do but to a third level... I currently have a dropdown that when selected populates two different radio groups with the correct information.
The dropdown id is "storename" and in the read I am using this for the where condition -
created_by_alias:{data:storename}
This seems to work as intended
What I would like to add is when the user makes a selection from the radio groups I would like to pass the data "introtext", "alias" and various other values from the database to text fields and/or hidden fields to be used for other calculations as well as information displayed to the user.
I tried using a text field but I couldn't figure out how to pass the information so I figured I would try with another radio group since I got that to work before...
I tried adding another radio group but I can only get it to work doing a read event with the dropdown id "storename", this shows the values from both radio groups and obviously won't change when the user makes a radio selection
I would like it to pull from a selection from the radio group with the id "discount"
I tried using another read with the following but had no success -
id:{data:discount}
Here is a front end view using the data from the dropdown "storename" -
link
The dropdown id is "storename" and in the read I am using this for the where condition -
created_by_alias:{data:storename}
This seems to work as intended
What I would like to add is when the user makes a selection from the radio groups I would like to pass the data "introtext", "alias" and various other values from the database to text fields and/or hidden fields to be used for other calculations as well as information displayed to the user.
I tried using a text field but I couldn't figure out how to pass the information so I figured I would try with another radio group since I got that to work before...
I tried adding another radio group but I can only get it to work doing a read event with the dropdown id "storename", this shows the values from both radio groups and obviously won't change when the user makes a radio selection
I would like it to pull from a selection from the radio group with the id "discount"
I tried using another read with the following but had no success -
id:{data:discount}
Here is a front end view using the data from the dropdown "storename" -
link
So when you select an option from the dropdown you want to reload a whole bunch of fields at once? That's a bit more complicated. You might have to wrap them all in a custom div with a set data-reloadurl or make your own Ajax call.
Since I can get the database id from the radio group selection I would like to pull information from the database based on that id. So, when a user makes a selection I can display other details about that selection.
Here is my goal -
A user makes a selection from the dropdown (Store)
which loads radio group options (Discounted Gift Cards) and (Cashback Sites)
the user makes a selection from radio group (Discounted Gift Cards)
I would like to display the discount value which would be the "introtext" field in the database and the article title which would be the "title" field in the database as well as other fields such as the url link to the article and some other information
I have limited knowledge of what you're suggesting, is there somewhere you could point me for information on how I could go about doing this?
Here is my goal -
A user makes a selection from the dropdown (Store)
which loads radio group options (Discounted Gift Cards) and (Cashback Sites)
the user makes a selection from radio group (Discounted Gift Cards)
I would like to display the discount value which would be the "introtext" field in the database and the article title which would be the "title" field in the database as well as other fields such as the url link to the article and some other information
I have limited knowledge of what you're suggesting, is there somewhere you could point me for information on how I could go about doing this?
okay so you want multiple fields from the database displayed as the label of a radio select option?
I'd rather just have certain fields from the database displayed as individual text boxes or hidden fields independent of each other. I was only using a radio select option because I couldn't figure out how to do the text field...
I'd like to be able to display some of the individual fields for the user as well as have some hidden fields that I'll use for background calculations
I'd like to be able to display some of the individual fields for the user as well as have some hidden fields that I'll use for background calculations
if you don't need to have any of data put into fields you can't have a custom html block with data-reloadurl="{url:reload event}&tvout=view" and the reload event can just output the wrapper div with your data inside it. If you need all those fields populated then sorry but you'll need the wrapper div and a series of {view:field} entries inside.
I don't need the fields populated until the user makes a selection from the radio group. Then, based on the database "id" of the selection I would show the specific fields from the database. Here is an example I mocked up -

So does that mean I make an html block and put this in it - data-reloadurl="{url:reload event}&tvout=view" then put a reload event in the radio group?
or am I supposed to do something like this in the html -
<div id="wrapper">
{view:}id:{data:discount}
{view:}title:{data:discount}
{view:}introtext:{data:discount}
{view:}id:{data:portal}
{view:}title:{data:portal}
{view:}introtext:{data:portal}
</div>

So does that mean I make an html block and put this in it - data-reloadurl="{url:reload event}&tvout=view" then put a reload event in the radio group?
or am I supposed to do something like this in the html -
<div id="wrapper">
{view:}id:{data:discount}
{view:}title:{data:discount}
{view:}introtext:{data:discount}
{view:}id:{data:portal}
{view:}title:{data:portal}
{view:}introtext:{data:portal}
</div>
Do you just need to DISPLAY those fields or do you need to send their data too
Some fields I just want to display but some I want to do math with. I don't think I'll need to send them.
So if a user selects the first selection in Discounted Gift Cards radio group I would display on screen some details about the store
title - A Pea in the Pod
introtext - 25.14
id - 9538
same with second radio group
in the background (hidden fields) I'd do some math. Adding together and multiplying fields and displaying the total on screen
25.14 - introtext (Discounted Gift Cards)
+
4.0 - introtext (Cashback Portal Sites)
+
-- user input
So if a user selects the first selection in Discounted Gift Cards radio group I would display on screen some details about the store
title - A Pea in the Pod
introtext - 25.14
id - 9538
same with second radio group
in the background (hidden fields) I'd do some math. Adding together and multiplying fields and displaying the total on screen
25.14 - introtext (Discounted Gift Cards)
+
4.0 - introtext (Cashback Portal Sites)
+
-- user input
So you can use a custom html that you target
<div id="shopinfo" data-reloadurl="{url:event name}&tvout=view"></div>
In the reload event do the read data , then a custom code block containing that wrapper div with all the information you want. Do your calculations with PHP, display the information however you want.
<div id="shopinfo" data-reloadurl="{url:event name}&tvout=view"></div>
In the reload event do the read data , then a custom code block containing that wrapper div with all the information you want. Do your calculations with PHP, display the information however you want.
Yes you have the syntax wrong.
Under your "Setup" Tab you need to create a new event, and the name of that event goes in {url:event_name}
In your custom code block instead of {view:}id{data:id} you need
Under your "Setup" Tab you need to create a new event, and the name of that event goes in {url:event_name}
In your custom code block instead of {view:}id{data:id} you need
ID: {var:read_data#.model.field}And instead of select type being an array of key/value pairs it should be first found, matching the thing they selected from the radio.
Ok, I added a new event and updated the custom code and changed the Read to First Matching. Seems to be working ok but only if I point the Where Condition in the Read to the dropdown which is this -
The dropdown selection fills in the radio groups and I'd like to get the info from the radio groups, I thought the syntax in the Read event Where Condition would be this -
Front end link showing the read pointing to the dropdown - link
created_by_alias:{data:storename}That grabs the first of all the radio group options.
The dropdown selection fills in the radio groups and I'd like to get the info from the radio groups, I thought the syntax in the Read event Where Condition would be this -
id:{data:portal}I think... But I don't know how to reload the read event after I've made a selection from the radio group so the custom code block stays blank
Front end link showing the read pointing to the dropdown - link
Wrll that second radio also needs an onchange event
where do I put the Wrll? in the Where Event like this
read_data17
but I have a feeling that's not correct
I have the radio groups reading from read_data9 & read_data15
with a Where condition -
id:{Wr||data:portal}I do have an onchange event in both radio groups set to
read_data17
but I have a feeling that's not correct
I have the radio groups reading from read_data9 & read_data15
with a Where condition -
created_by_alias:{data:storename}
*well. Typo, and also not something you should be putting in like you have.
The onchange event should be set to the name of your event, not the name of an action. There should be one event for each thing so one for when the user selects the first option to reload the radios and one for when they select a radio to show the information.
You should look closer at the dynamic dropdown demo it shows all these concepts fairly clearly.
The onchange event should be set to the name of your event, not the name of an action. There should be one event for each thing so one for when the user selects the first option to reload the radios and one for when they select a radio to show the information.
You should look closer at the dynamic dropdown demo it shows all these concepts fairly clearly.
I have a basic understanding of how the dynamic dropdown works but am still relatively new to Chronoforms. I know I'm close to what I need but I have something wrong somewhere and I keep trying different things but I have no idea if I'm changing the correct thing or if I have a simple typo somewhere.
I keep looking at the demo and I seem to understand it, I've got a dropdown that when selected populates the radio groups correctly. I just don't know how to join the information from the radio group selection with the read event to display the info from the database
I'm not sure what the event is, the custom code or the event loader or something else. For all I know I'm making changes to something that is already correct and just going further down a wormhole....
I keep looking at the demo and I seem to understand it, I've got a dropdown that when selected populates the radio groups correctly. I just don't know how to join the information from the radio group selection with the read event to display the info from the database
I'm not sure what the event is, the custom code or the event loader or something else. For all I know I'm making changes to something that is already correct and just going further down a wormhole....
Well what is the value you're using for the radio? Use whatever you need to search the database when they select an option.
"id" is the value of one of the radio groups (name and id set as "portal") so I was trying to do a new read event with this in the Where Condition -
id:{data:portal}but I can't seem to figure out how to display it. I got it working correctly if I do the custom code pointing at the first level dropdown but that isn't the solution I need...
Screnshot of the events tab for that radio thanks.
At some point you might have to just consider paying me to do it for you seem to be going in circles.
At some point you might have to just consider paying me to do it for you seem to be going in circles.

This topic is locked and no more replies can be posted.