[Closed] Radio Button pre-select value
I'm trying to add a simple Yes No radio button. There's a reason why this HAS to be a radio button. I would like the default value to be Yes. Is there a way to do this as in HTML?
The developers know about your question and currently trying to find some solution for you. I'll update the topic once I get some response from them.
Also please don't duplicate questions and topics in both forums. All questions related to the wpForo Paid Addons should be asked here.
We've added a feature to set default value for checkbox, radio and select fields. It contains changes in the core wpForo plugins so it'll be available with next version release.
However, you can add it in your wpForo installation now. You should change one file in the plugin. Use some FTP Client or Hosting Service cPanel > File manager and change the class-forms.php file.
1. Download this zip file ( class-forms.php.zip ).
2. Unzip and find the class-forms.php file.
3. Upload and replace your current /wp-content/plugins/wpforo/wpf-includes/class-forms.php file.
4. Once the file is uploaded, you can set default value by inserting brackets "[" and "]" in the beginning and in the end of the default option in Field Editing screen. Also, make sure the Radio Button option is set required:
In case you use value => label syntax, you should put brackets around the whole row:
- [1 => Yes]
- 0 => No
Tom. Firstly many thanks for this now excellent response. I've installed the new file and can say that the preselection works well.
However there does seem to be an issue. The Yes/No field is presented in the 'Account' Form correctly with the "Yes" preselected. Good so far.
However if one then clicks on 'Profile' form, the Yes/No field has not appeared .... presumably the Profile Form is not recognising that the Yes/No field has been populated and therefore does not display it. This kind of defeats the object of the exercise as other members viewing profile are not going to see the preselected value.
Is there anything you can do on this please? Or is there something else that I need to do? Confident to tweak php at this end if you can suggest anything.
PS .... If I use the form you suggest
Then when the Account Form is saved, this field in the Profile Form is display as "1" , not Yes.