• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Adding 'other' as Dropdown option

Adding 'other' as Dropdown option 2 years 6 months ago #42309

  • web.admin27
  • web.admin27's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 1
I'm creating a form that includes 'Title' (Mr. Mrs. etc.)
Rather than anticipating all the possiblilites I would like to show the most frequently used but have Other as one of the options with a text box the user can write in their particular preference.
I am sure this is a common requirement, so any ideas?
The administrator has disabled public write access.

Adding 'other' as Dropdown option 2 years 6 months ago #42311

  • dragos
  • dragos's Avatar
  • OFFLINE
  • Administrator
  • Posts: 634
  • Thank you received: 117
Hello,

You can try taking a look at this article.
The administrator has disabled public write access.
The following user(s) said Thank You: web.admin27

Adding 'other' as Dropdown option 2 years 6 months ago #42312

  • web.admin27
  • web.admin27's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 1
Excellent - all sorted.
The administrator has disabled public write access.

Adding 'other' as Dropdown option 2 years 6 months ago #42313

  • web.admin27
  • web.admin27's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 1
Well Almost sorted.
I'm using the fields in emails, etc.
So:
Dear {Title:value} {SName:value}, will display as
Dear Mr Smith (for example) or Dear Miss Smith depending on the value chosen from the dropdown.
However if the value 'Other' is selected from the title dropdown, I get the new box displayed (as in the article you suggest)
But this time I will get
Dear Other Smith,using the above syntax.
Ideally I want Title to take on the {SpecifyBelow:value} (or the other way round). Alternatively some logic in the message that displays {SpecifyBelow:value} instead of {Title:value} if {Title:value} = 'Other'
Any ideas?
The administrator has disabled public write access.

Adding 'other' as Dropdown option 2 years 6 months ago #42314

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 246
  • Thank you received: 64
Try this

{if {Title:value}}Dear {Title:value} {Sname:value} {/if}
{if {Other:value}}Dear {Other:value} {Sname:value} {/if}

This translates as if title:value has a value echo 'Dear Miss Smith' otherwise if no title is selected (has no value) do nothing. If the chose the 'Other' field and enter 'Reverend' for example you'll get 'Dear Reverend Smith'

You should probably add the scripts found here before using the above
https://www.rsjoomla.com/support/documentation/rsform-pro/frequently-asked-questions/using-the-if-statement-with-rsformpro-pdf-plugin.html
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
Last Edit: 2 years 6 months ago by iceferret.
The administrator has disabled public write access.

Adding 'other' as Dropdown option 2 years 5 months ago #42321

  • web.admin27
  • web.admin27's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 1
Sorry for my delay in saying thanks, but I have been off-line for a few days.
Two follow ups.
The instructions shown in the linked page don't seem to match the form edit screen I get. Mine refers to 'Scripts called before form is generated' and 'Scripts called before form is validated' rather than 'User Email Pre-processing PHP Script' and 'Admin Email Pre-processing PHP Script' I'm using RSForm Pro 4.2.4, I wonder if something has changed.
Also.
Is the an {else} option available as in :
{if {name_of_field:value}} Display this text if the form_component field has a set value.{else}Display this alternative text {/if}
The administrator has disabled public write access.

Adding 'other' as Dropdown option 2 years 5 months ago #42322

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 246
  • Thank you received: 64
You're right, the instruction doesn't match, never noticed that. Put them in User PDF Pre-processing PHP Script and Admin PDF Pre-processing PHP Script. It may be you don't need to do that for emails, I had PDF's organised before I even used {if} in emails but they (emails) may not work without it

As far as I'm aware there is no 'else' option hence the two statements.
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
Last Edit: 2 years 5 months ago by iceferret.
The administrator has disabled public write access.

Adding 'other' as Dropdown option 2 years 5 months ago #42323

  • web.admin27
  • web.admin27's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 1
That was quick! thanks again. In practice it all seems to work without the additional script. Also, I have played around and produced what is in effect an {else} syntax that works where I need it so far. Onward and upward!
The administrator has disabled public write access.

Adding 'other' as Dropdown option 2 years 5 months ago #42324

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 246
  • Thank you received: 64
I'd be very interested to see how you worked the{else} into it, would save writing lots of statements
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
Last Edit: 2 years 5 months ago by iceferret.
The administrator has disabled public write access.

Adding 'other' as Dropdown option 2 years 5 months ago #42327

  • web.admin27
  • web.admin27's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 1
I had collected a landline phone number and wanted to include it in the email, but if the user had not given a number then I wanted to write 'No Number Given'
So:
Landline: {Landline:value}{if {Landline:value}=}No Number Given {/if}
displays as Landline:01234 567890 or Landline: No Number Given (depending on the user input)
Although not clearly documented, it turns out that {Landline:value}=} is treated as If {Landline:value}=Null}
All the best,
Alan
The administrator has disabled public write access.
The following user(s) said Thank You: iceferret
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!