Unfortunately, the username and password you have entered do not match!

Registration

Unfortunately, this username is already taken!

Unfortunately, this e-mail address is already used!

Please retype the verification code.

All fields are required

20 Feb 2012

Show / Hide a field in RSForm! Pro

Posted by. Octavian Cinciu This article was posted in RSForm!Pro Tagged with joomla extensions , forms , rsform! pro , conditional fields , show hide
HomePrintE-mail
RSForm!Pro Logo

With the latest revision of our Joomla! form builder RSForm! Pro we have added a much desired feature - conditional fields.

What are "Conditional Fields"?

Conditional fields allow you to show or hide a field based on the user's selections. With this article we will guide you in using these type of conditions. For a better understanding, we will start by modifying the "RSForm! Pro example" form. This form comes preinstalled with RSForm! Pro, so you should be good to go.

Let's add a new option to the "ContactBy" field.

Edit the field to add a new optionStart by editing the ContactBy field - next to each field you will find an Edit icon. Click on that icon and a new window will popup from the left. We already have a list of options here in the "Items" area so we will add a new one at the end, let's say "Other". Remember that each checkbox option will have to be a new line.

Adding the new optionAfter you're done, click on "Save". The final result we're trying to achieve here is to present a new field to the user if he selects the "Other" checkbox, so he can type in whatever he wants without being constraint by the predefined checkboxes.

We need a new textbox to show up now.

Adding the new textbox for the new optionNow it's time to create the textbox that will show up to the user. In the Form Fields list on the left, click on "Textbox". A window will popup from the left and you will be able to add "SpecifyBelow" as the field's name (this is the internal name that is used). Next, fill the caption as "Other".

The new textbox has been addedIf you want to specify additional options, feel free to do so - you can set "Required" to "Yes" (from the "Validations" tab) so that the field will become mandatory. Don't worry - this field will eventually be required just for people who will check the "Other" checkbox. Click on "Save".

Let's create a new condition.

Conditional FieldsThis is the part we've introduced with RSForm! Pro R43 - Conditional Fields. Head over to the "Properties" tab located on the top and then click on "Conditional Fields" from the left side. We don't have any conditions yet so we'll have to click on "New Condition". A modal window will popup.

Conditional FieldsHere you can specify if you want to show or hide the field (from the first dropdown). Let's select "Show". We'll select the "block (label + field)" option from the second dropdown so that the whole field, along with the caption, will be shown. In the third dropdown we will need to specify the field we would like to show, so let's click on "SpecifyBelow", which is the textbox we've added earlier. The last dropdown has no effect for our case now, since we will need to add only one condition, so we will skip it. Now, click on the "Plus" icon on the right.

New ConditionYou will notice that three new dropdowns have appeared below. The first dropdown shows a list of fields that are either "Dropdowns", "Radio Groups" or "Checkbox Groups". We need to show the "SpecifyBelow" field if the user selects "Other" from the "ContactBy" checkboxes - so, select "ContactBy" from the first dropdown, "is" from the second one (which contains a list of conditions) and "Other" from the last (which contains a list of all the values from the field you've selected in the first dropdown). We're all done, click on "Save" now. The conditions are saved without refreshing or saving the form, so we don't need to click on "Save" on the form.

Let's see it in action!

See the field in actionNow that we're done, click on "Preview" to preview your form. You will notice that the "Other" textbox is not shown. Tick the "Other" checkbox - the textbox will appear below.



Gravatar
Claudio Fernandez (20.02.2012 (07:15:07))
Now this is PER-FECT ! 2 Man ! That was the last missing piece of the puzzle to make RSForms!Pro absolutely PER-FECT !.

There were two missing pieces in RSForms Pro when I began to use it a few years ago ( coming from the wforms library )

1) Pagination ( added to RSForms Pro some time ago now ... )
2) Conditional fields
Conditional fields was the last piece I missed ... until now !

Thank you guys, I think you have the best Form generator available in the web today, in or out of Joomla!.
Quote
Gravatar
Richard Boczan (20.02.2012 (07:52:05))
Not working 3 I am glad you've showed up with this new feature. I've made a new form just to try it, followed description step by step, does not want to work. Any other settings required in joomla? What did I do wrong? Waiting for your answerQuote
Gravatar
R Mulder (20.02.2012 (07:58:58))
1 Finaly! Forms now can look so mutch cleaner thanxs to RS FormsQuote
Gravatar
Jens Lorentsen (20.02.2012 (08:10:12))
Not working Yes No Hia!
This is an awesome addition, but im having trouble getting it working. The first condition works as a charm but any extras dont
Quote
http://landbrugslederen.dk
Gravatar
FPAS FPAS (20.02.2012 (08:26:32))
get this version Yes No my version don´t have that feature can i have un update?

how i must do to have this update?
Quote
Gravatar
Royce Harding (20.02.2012 (09:52:08))
Is this currently available? Yes No The update link in the Joomla! admin points to rev 42??Quote
Gravatar
Chris Clay (20.02.2012 (12:49:04))
Woohoo! Thank you :) Yes No Thanks for this new feature! I spent many hours last week trying to do the same thing with Javascript. While I was starting to get it working, the new conditional option is sooo much easier.

Cheers,
Chris
Quote
http://www.digitalbloom.ca/
Gravatar
Kevin McElligott (20.02.2012 (15:08:30))
Free Text 1 I tested this with Freetext and it does not work. Ideally, when someone selects "track my order" from the contact form checkboxes, a freetext blurb can pop-up saying, Did you know you can login to your account to track your order?" -- you get the idea.Quote
Gravatar
Octavian Cinciu (21.02.2012 (01:26:12))
2 The XML didn't say R43 so we've fixed that :)
You should keep in mind that you'll need "Auto Generate Layout?" enabled for this to work since it heavily relies on HTML that's generated in a certain way to work.
If anyone has trouble implementing this, please submit a support ticket and we'll take a look.
Quote
Gravatar
Thomas Egan (21.02.2012 (13:48:35))
Works great! 1 This arrived in the nick of time. I had already been looking at another form tool when this update arrived. I was able to get it working in about 5 minutes and just added additional conditions to show/hide multiple fields when a specific radio button was selected. Thank you for this much appreciated feature!!!!Quote

Page 1 sur 4

1000 Characters left

Antispam Refresh image Case sensitive

Feedback