Buy Now
Sign in

Displaying Fields from the DB based on Radio Button Selection

cre8tivemedia , November 03 at 16:58
C
cre8tivemedia
I'm using Javascript to get the value of the "id" in the DB from the radio buttons as follows
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 -
data-find.png
Can I do this with Javascript or do I need to have another read action to be able to get these fields?
CuttingCoupons.net
healyhatman
Unless you already have that data loaded and somewhere on your form, you'll need to re-read.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman
C
cre8tivemedia
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
CuttingCoupons.net
healyhatman
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.
Web developer at SkySpider.com.au
I don't work for ChronoEngine but I do accept donations paypal.me/healyhatman