Notifications
Clear all

[Closed] Radio Button pre-select value

14 Posts
3 Users
0 Likes
1,931 Views
Posts: 11
Topic starter
(@engagingemotions)
Active Member
Joined: 4 years ago

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?

13 Replies
Elvina
Posts: 1403
(@elvina)
Support
Joined: 5 years ago

Hi @engagingemotions,Β 

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.

Posts: 4168
 Tom
Admin
(@tomson)
Famed Member
Joined: 9 years ago

Hi @engagingemotions,

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:

  • [Yes]
  • No
wpForo Users Custom Field Addon set default value

In case you use value => label syntax, you should put brackets around the whole row:

  • [1 => Yes]
  • 0 => No

Β 

Posts: 11
Topic starter
(@engagingemotions)
Active Member
Joined: 4 years ago

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.

Posts: 11
Topic starter
(@engagingemotions)
Active Member
Joined: 4 years ago

PS .... If I use the form you suggest

[1=>Yes]

0=>No

Then when the Account Form is saved, this field in the Profile Form is display as "1" , not Yes.Β 

2 Replies
Elvina
(@elvina)
Joined: 5 years ago

Support
Posts: 1403
Posted by: @engagingemotions

However if one then clicks on 'Profile' form, the Yes/No field has not appeared

The Yes/No will be displayed once user saved own profile data. Also, you should add this field in Profile page in Dashboard > Forums > Member Fields > Profile Page Tab.

We also suggest that you add all required fields in the registration form.

 Tom
Admin
(@tomson)
Joined: 9 years ago

Famed Member
Posts: 4168

@engagingemotions

Yes, it's correct. We recommend use just "Yes" without "1".

Page 1 / 2
Share:
Scroll to top