Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Radio group
Radio group
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
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
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Radio group
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:
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:
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Radio group
Each object will still have its own ID. Do you want to retrieve the selected object/radio button of a group?
-
- Posts: 5
- Joined: Thu Apr 24, 2025 8:00 pm
- Has thanked: 2 times
Re: Radio group
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
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
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Radio group
For each readio button, add an onchange handler, e.g.
In the form's Custom Code field, add a function like this:
handleRadioChange(this);
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');
}
You do not have the required permissions to view the files attached to this post.
Re: Radio group
Good, and how about one checked by default? Cos 'defaultChecked/checked' added to attributes list didn't affect 

-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Radio group
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
sorry, nuSetValue doesn't do default check, seems to me it just alters the id of an element
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact:
Re: Radio group
In nucommon.js, function nuSetValue():
Modify
Replace with
Save changes, login again in nuBuilder and try again.
Modify
Code: Select all
} else if (obj.is(':checkbox')) {
Code: Select all
} else if (obj.is(':checkbox') || obj.is(':radio')) {