Page 1 of 2
Radio group
Posted: Thu Apr 24, 2025 8:53 am
by Uzlander
Hello everybody! Just fugured there's an input type Radio, but couldn't figure how to implement Radio Group to pick from.
So i only create separate buttons selectable (not even untickable), and there seem no configuration to assemble them as a group.
I basically want to assign it 'categories' (then serve as a filter for 'subcategories' dropdown).
Please help me understand
Re: Radio group
Posted: Thu Apr 24, 2025 9:42 am
by kev1n
Hi,
Good question!
If you want multiple radio objects to behave as a group (i.e. selecting one will unselect the others), you should give them the same name attribute.
For example:
radio_group_1.png
Re: Radio group
Posted: Thu Apr 24, 2025 2:41 pm
by Guest
then i believe object's ID gonna be dynamic value for the Group ?
Re: Radio group
Posted: Thu Apr 24, 2025 4:05 pm
by kev1n
Each object will still have its own ID. Do you want to retrieve the selected object/radio button of a group?
Re: Radio group
Posted: Fri Apr 25, 2025 8:35 pm
by uzlander_ya
Would be good to see an example tracking the group's changing value due to selection of corresponding radio-button, and assign a group an onChange event to trigger other procedures down the work flow.
My scenario is following: Two base taxonomies(tables): Categories(Code, Description) and Subcategories(CategoryID, SubcategCode, SubcategDescription, etc..).
Then lets present Categories in the form as radio buttons(group) which upon selection/change trigger next element(dropdown) Subcategories to be filtered out accordingly. Its ok for me to have fixed set of categories-buttons. Now It seems LOOKUP field doesn't have a config to filter the table it looks up but SELECT field can utilize the flexibility of an sql so we use the Categories group's hashcookie there in the WHERE statement to have the dropdown (Subcategories)list filtered dynamically.
So here the radio group comed handy and looks as a neat implementation to me. Please show us how to track the current selected of a group
Re: Radio group
Posted: Sat Apr 26, 2025 6:55 am
by kev1n
For each readio button, add an onchange handler, e.g.
handleRadioChange(this);
onchange.png
In the form's Custom Code field, add a function like this:
Code: Select all
// Called whenever a radio button's selection changes
function handleRadioChange(radio) {
// Log the ID of the selected radio button for debugging
console.log("Selected radio button ID:", radio.id);
// Set a Hash Cookie, that is used in the select SQL, not quite sure what value should be set though
nuSetProperty('your_hash_cookie', 'set_some_value_here');
// Refresh a related select object to reflect any changes based on the new selection
nuRefreshSelectObject('mySelectObjectId');
}
Re: Radio group
Posted: Sat Apr 26, 2025 12:47 pm
by Uzlander
Good, and how about one checked by default? Cos 'defaultChecked/checked' added to attributes list didn't affect

Re: Radio group
Posted: Sat Apr 26, 2025 1:01 pm
by kev1n
Add an onload event to the radio object you want to have checked when the form loads, then set its checked state using JavaScript: nuSetValue(this.id, true);
Re: Radio group
Posted: Mon Apr 28, 2025 8:30 am
by Uzlander
sorry, nuSetValue doesn't do default check, seems to me it just alters the id of an element
Re: Radio group
Posted: Mon Apr 28, 2025 8:41 am
by kev1n
In nucommon.js, function nuSetValue():
Modify
Code: Select all
} else if (obj.is(':checkbox')) {
Replace with
Code: Select all
} else if (obj.is(':checkbox') || obj.is(':radio')) {
Save changes, login again in nuBuilder and try again.