dbcom
 XMod Jr. Varsity Posts: 13

 |
| 8/27/2008 5:21 PM |
|
I'm trying to build a form that includes radio button selections with the last option being 'other', and then including a textfield for the user to specify. It seems like a fairly simple task, but I can't seem to find anything after searching the forums and the exchange. Would greatly appreciate any code or lead directions. Thanks in advance. dbcom |
|
|
|
|
fatgeorge
 XMod All-Star Posts: 644
 www.fatgeorge.co.uk UK
 |
| 8/28/2008 4:36 AM |
|
The simplest way to achieve this would be as follows: Create your radio button list using a <Select1> tag then directly after it place a normal <input> tag. In your templates you would need to test the value of the radio button list, if it is other then use the value in the input field else use the value of the radio button list. in the form: [<select1 ref="rblTest" appearance="full" class="NormalTextBox"> <label>Test: </label> <items> <item> <label>Male</label> <value>M</value> </item> <item selected="true"> <label>Female</label> <value>F</value> </item> <item> <label>Other</label> <value>other</value> </item> </items> </select1> <input ref="txtOther" > <label>Other</label> </input> ] In the template: [ <xmod:if name="rblTest" value="other"> <xmod:field name="txtOther" /> <else> <xmod:field name="rblTest" /> </else> </xmod:if> ] |
|
we don't make XMod, we make it better! |
|
|
dbcom
 XMod Jr. Varsity Posts: 13

 |
| 8/29/2008 2:23 AM |
|
Thanks, fatgeorge, it worked perfectly for this designer/non-programmer. I hate to ask another deeper reaching question, so any feedback is greatly appreciated as you helped me out a lot with this. Here goes.... "Is it possible to place the textfield option for 'other' on the same line if using the 'repeatcolumns' property?" again, thanks for any additional help here. dbcom |
|
|
|
|
dbcom
 XMod Jr. Varsity Posts: 13

 |
| 8/29/2008 2:39 AM |
|
| Nix that. I applied some styling to the input field to move it into position. |
|
|
|
|
fatgeorge
 XMod All-Star Posts: 644
 www.fatgeorge.co.uk UK
 |
|
dbcom
 XMod Jr. Varsity Posts: 13

 |
| 8/29/2008 1:36 PM |
|
Certainly...granted the input field is an inline style, I assume this could be worked into a stylesheet. ----------------------------------------------------- FORM CODE: ----------------------------------------------------- <strong>Which option best describes you:</strong><br/> <select1 ref="Description" appearance="full" class="NormalTextBox" required="false" repeatcolumns="1"> <label>Description</label> <items> <item> <label>Student</label> <value>Student</value> </item> <item> <label>Teacher</label> <value>Teacher</value> </item> <item> <label>Administrator</label> <value>Administrator</value> </item> <item> <label>Other (please specify):</label> <value>Other</value> </item> </items> </select1> <input ref="DescriptionOther" style="float:right;margin:-20px 243px 0 0;"><label>DescriptionOther</label></input> ----------------------------------------------------- TEMPLATE CODE: ----------------------------------------------------- <xmod:if name="Description" value="Other"> <xmod:field name="DescriptionOther" /> <else> <xmod:field name="Description" /> </else> </xmod:if> |

|
|
|
|
fatgeorge
 XMod All-Star Posts: 644
 www.fatgeorge.co.uk UK
 |
| 8/29/2008 3:01 PM |
|
Thanks for sharing, that looks really good. I wonder if it would be possible using the Validation tag to somehow check that if other is selected then the input field is populated. |
|
we don't make XMod, we make it better! |
|
|