11.21.2008
Register     Login      
 
DotNetNuke Platinum Benefactor

We're happy to show our support for the DotNetNuke platform and community by contributing back to the project at the highest "Platinum" level.

XMod Form & Template Exchange Highlights
Here's a few of the latest additions to the XMod Form & Template Exchange. The Exchange contains snippets, samples, and solutions. It's free and open to all XMod users. We encourage you to use the samples and submit your own.

Visit the Exchange
Contribute to the Exchange

Mashups for XMOD
by Ray Chance
Java Enabled form with email
by Tony Smith
YouTube Video Include
by Patrick Cummings
BrightCove Player using the BrightCove ID ( Flash Player)
by Craig Porter
Kill the 'Edit Item' title
by Eric Mourant
Fading News Ticker
by Kelly Ford
GymnasticsMedia Store
by GymnasticsMedia
Parent Child Relationship For Categories (Select1)
by Ben Bahrenburg
Link Exchange
by Ben Bahrenburg
Fast and Easy News Scroller
by Sean Moran
Powered By XMod
DNNDev.com Forums
Subject: Radio Button/Text Field Combo?
Prev Next
You are not authorized to post a reply.

Author Messages
dbcomUser is Offline
XMod Jr. Varsity
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
fatgeorgeUser is Offline
XMod All-Star
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!
dbcomUser is Offline
XMod Jr. Varsity
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
dbcomUser is Offline
XMod Jr. Varsity
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.
fatgeorgeUser is Offline
XMod All-Star
XMod All-Star
Posts: 644

www.fatgeorge.co.uk
UK


8/29/2008 3:05 AM  
sounds good, can you attach a screenshot and code example to show us what you have achieved please?

we don't make XMod, we make it better!
dbcomUser is Offline
XMod Jr. Varsity
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>





fatgeorgeUser is Offline
XMod All-Star
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!
You are not authorized to post a reply.
Forums > DNNdev Forums > XMod > Radio Button/Text Field Combo?



ActiveForums 3.7
       Terms Of Use      Privacy Statement      © 2004-2008 Kelly Ford