Appreciate if someone can provide an example on how to deploy form radio button (e.g. 3 selections) and where to check which selection has been selected. Thank you.
Regards,
London Gypsy
Need Help on Form Radio Button
4 years ago
4 years ago
#1
4 years ago
#2
Hello London,
Here is the code from tg_helpers/form_helper.php in the engine folder.
Also Check here in the Docs.
https://trongate.io/docs/information/the-form-helper
Dan
Here is the code from tg_helpers/form_helper.php in the engine folder.
Also Check here in the Docs.
https://trongate.io/docs/information/the-form-helper
Dan
4 years ago
#3
name should be common in all the three radio buttons.
4 years ago
#4
Thanks to Dan & Freiza for the previous replies!
The problem I encountered with the radio button is after executing the following steps:
1) Answered Question 2 but not Question 1 (to test out the validation checks)
2) Clicked the Submit button
3) Screen displayed the validation error message for Question 1
4) Question 2 answer is not being displayed.
The problem I encountered with the radio button is after executing the following steps:
1) Answered Question 2 but not Question 1 (to test out the validation checks)
2) Clicked the Submit button
3) Screen displayed the validation error message for Question 1
4) Question 2 answer is not being displayed.
4 years ago
#5
Can you post your code?
4 years ago
#6
Hello Freiza,
I enclosed my code between the tags but somehow it cannot be saved. Please advise, thanks.
I enclosed my code between the tags but somehow it cannot be saved. Please advise, thanks.
4 years ago
#7
Hi London gypsy,
If you want to paste code that contains php tags and other tags that gets stripped, use an online HTML entities converter then past that into a code block.
If you want to paste code that contains php tags and other tags that gets stripped, use an online HTML entities converter then past that into a code block.
4 years ago
#8
Hello DaFa, noted with thanks.
4 years ago
#9
It is a Boolean.
$checked should be, $checked=true in the form.
Also, to validate.
$this->validation_helper->set_rules('ans01', 'ans01', true);
$this->validation_helper->set_rules('ans02', 'ans02', true);
Dan
$checked should be, $checked=true in the form.
Also, to validate.
$this->validation_helper->set_rules('ans01', 'ans01', true);
$this->validation_helper->set_rules('ans02', 'ans02', true);
Dan
4 years ago
#10
Here's an example of how to draw a form with radio buttons that uses in-field validation errors. It's a brand new feature (so new that there are no docs yet!) and hopefully I'll have a video tutorial out shortly:
VIEW FILE
CONTROLLER FILE...
VIEW FILE
CONTROLLER FILE...