How do I add a textbox as a radiobox option

Tgoodrich 18 Apr, 2014
Hi,

I am creating a form that uses a radiobox field with several options. I need to have a textbox next to one of the radiobox buttons.

This textbox will be used so that the person filling in the form can write in what they want if none of the radio button chooses apply to them.

Basically a radio button choose of "other" they can fill in.

Thanks
Max_admin 18 Apr, 2014
Hi Tgoodrich,

There is no direct way to do this, but you have 1 of 2 ways:

#1- add the text box under your radios group and name it other, make it disabled and enable it when the other radio is checked using the "events" section.

#2- don't add an "other" radio to your radios group, and add a new "multi field" under your radios, in this multi field field you should have a radio + a text box, the radio should be only 1 option, which is "other", and you should give it the same name of the radios above it so that you can switch between all of them!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Tgoodrich 18 Apr, 2014
Hi Max,

Thanks for the how to on that, you know I never would have thought of that lol!

It looks like however I won't be able to use the radio box option as this question also pertains to the other radio box question I asked which was in regards to selecting multiple radio boxes.

So I am now going to replace the radio box with check boxes. I was able to apply your option #2 from this post but use check boxes instead of radio box. I have the form laid out with the check boxes and with a little css trickery you can't tell the check box + textbox isn't part of the first vertical row of check boxes. So it looks good

Now I need your confirmation on this to make sure I have things straight.
1st: replace my radio box field with check boxes.
2nd: Apply option #2 from this thread but use multi field checkbox + text box instead of radio + text box.
3rd: And this I'm not sure about, rename my multifield check box and text box field name and field ID to match field name and field ID of the original check box field?

As a side note, this form will be used to add records to a database table which I will then show using chronoconnectivity. If all these fields are named the same, will all the info be added to the same table field?

Hope this makes sense.

Thanks
Tgoodrich 19 Apr, 2014
Ok so I tried to make this work but it appears I still need some help.

I have my checkbox group which allows a user to make multiple selections from the checkbox group. In settings I added a "Handle Array" before the db save. So out of the 13 check boxes in the group the user can select 1 checkbox or all if they wanted and all of the data is put into the db separated by commas after the form is submitted which is the expected result.

Now concerning the multi field (check box + text field). I made its name the same as the check box groups name above and if the user fills in the checkbox it will add that record to the same place as the check box group mentioned above.

The problem is that its either one or the other but not both. The form will not save the check box group and check box + text field together in an array(hope i said that right). If a user chooses any of the group check boxes and then fills in the check box + text box, only the record from the text box is added to the db.

Do I need to have the check box + text box add records to the db in its own column and then have mySQL somehow merge the check box group column with the check box + text box column or is there a simpler way?

I'm afraid my lack of php and database knowledge may make what I wrote above not make sense so please let me know if I need to try and explain what I am trying to accomplish a little better.

Side Note: If it helps I am trying to duplicate the form located on this page, http://conservation.townofsalisbury.org/?page_id=951 and this entire post is in relation to the "Phenological Event" located in that form. (its a wordpress site and the form is a google docs form.. I'm tasked with recreating this site in Joomla and want to use chronforms instead of the google docs form)
Max_admin 22 Apr, 2014
Answer
Hi Tgoodrich,

Assuming your checkboxes group name is my_group[] then you may use the SAME name for the "other" text box, and set its "load state" to disabled, and a different name (any name) for the "other" checkbox BUT use the "events" section in the "other" checkbox to enable the textbox when its checked, this way the textbox value will be added to the data array only when its enabled, I didn't test it before though.

Another solution would be a different database field for the other text box, you can do it anyway you want since you are not obligated to follow a specific db design!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Tgoodrich 22 Apr, 2014
Hi Max,

Perfect, its now working just as I need it to! Thank you so much!
This topic is locked and no more replies can be posted.