Jump to content

Need a rule to let user choose btw picklist & "enter your own text"


Recommended Posts

I want to offer a VDP Banner that will display some custom text. I want the user to be able to pick between typing their own text manually or, if they choose, pick from a drop-down menu of pre-determined messages.

 

I only want one to be displayed, so if they start off typing manually and then realize they would rather have the preset messsage, all they have to do is pick from the drop-down and the half typed in message is replaced with the drop-down message.

 

I'm worried the banner will display both. How can I set up the rule so one field clears out the other - basically resetting it start/blank?

 

I'm assuming the template will need two text boxes with one sitting in front/on top if the other. The customer should only see two field in the form, a input box and a picklist

 

Thanks

 

-bob

Link to comment
Share on other sites

I don't use EFI, but I do work with custom front end portals. In your scenario, you would only need one text frame on your FP template with an associated rule that could check to see if the value of a field associated with the drop down list of preset messages is "custom" (in which case it would insert the contents of Field("Custom")) otherwise it would return the value of the preset message.
Link to comment
Share on other sites

So if I understand you correctly...,

 

My data source has 2 fields, one for my dropdown (with values for each) and one for the custom field (with an empty value.)

 

My template has one text box.

 

I create the HTML form with 2 fields. One multi-line text box labeled "Custom" and one Picklist with my 5 pre-set choices with values (does one of the choices have to be "Fill in custom message"?)

 

And I create the rule below...

 

if (Field("Dropdown").indexOf(Field("Custom")) > -1)

{

return "<span>" + Field("Custom") + "</span>";

}

else

{

return "<span>" + Field("Dropdown") + "</span>";

}

return "";

Link to comment
Share on other sites

That looks about right although I don't think you need the 3rd return since your rule would either return something from your picklist, or the contents of your custom field (if the picklist option for "custom value" is selected.

 

I don't know about EFI's capabilities, but if we were setting this up, I would go the extra measure of only displaying the custom text field on the portal when the "custom value" is selected in the pick list. :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...