<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: How to make radio box be selected when user enters accompanying text.</title>
	<link>http://ask.metafilter.com/46388/How-to-make-radio-box-be-selected-when-user-enters-accompanying-text/</link>
	<description>Comments on Ask MetaFilter post How to make radio box be selected when user enters accompanying text.</description>
	<pubDate>Tue, 12 Sep 2006 11:46:25 -0800</pubDate>
	<lastBuildDate>Tue, 12 Sep 2006 11:46:25 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: How to make radio box be selected when user enters accompanying text.</title>
		<link>http://ask.metafilter.com/46388/How-to-make-radio-box-be-selected-when-user-enters-accompanying-text</link>	
		<description>In a web survey form, I need to automatically check a radio box if the user clicks on the text field. &lt;br /&gt;&lt;br /&gt; I have a questionnaire with &quot;Other (please specify)&quot; as a radio option, with a text field next to it. I would like to have the radio button automatically selected if the user decides to just type a name in the text field and ignoring the radio box. I saw a javascript that checks the radio button, however you can&apos;t type into the accompanying text field...&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/form&gt;&lt;br&gt;
&lt;br&gt;
I&apos;m not that great at javascript. Help!</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2006:site.46388</guid>
		<pubDate>Tue, 12 Sep 2006 11:44:53 -0800</pubDate>
		<dc:creator>Blue Buddha</dc:creator>
		
			<category>javascript</category>
		
			<category>form</category>
		
			<category>survey</category>
		
			<category>questionnaire</category>
		
			<category>formfield</category>
		
			<category>radiobox</category>
		
			<category>textfield</category>
		
	</item> <item>
		<title>By: Blue Buddha</title>
		<link>http://ask.metafilter.com/46388/How-to-make-radio-box-be-selected-when-user-enters-accompanying-text#707869</link>	
		<description>Er, I guess you can&apos;t have forms in posts (where that empty space is). You can check the javascript, slightly modified, &lt;a href=&quot;http://www.irt.org/script/111.htm&quot;&gt;here&lt;/a&gt;.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.46388-707869</guid>
		<pubDate>Tue, 12 Sep 2006 11:46:25 -0800</pubDate>
		<dc:creator>Blue Buddha</dc:creator>
	</item><item>
		<title>By: apark</title>
		<link>http://ask.metafilter.com/46388/How-to-make-radio-box-be-selected-when-user-enters-accompanying-text#707872</link>	
		<description>What you&apos;ll want to do is handle the onClick, onChange, or the onFocus event (depending on the desired behavior) of the text field and use the handler to modify the value of the radio button. Actually, you probably want to use the onChange event because if the user is navigating using a keyboard, you don&apos;t want the other events to fire and invalidate his/her answer when it navigates through the &quot;Other&quot; field.&lt;br&gt;
&lt;br&gt;
This &lt;a href=&quot;http://www.wdvl.com/Authoring/JavaScript/Tutorial/handlers.html&quot;&gt;site &lt;/a&gt;is helpful.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.46388-707872</guid>
		<pubDate>Tue, 12 Sep 2006 11:53:51 -0800</pubDate>
		<dc:creator>apark</dc:creator>
	</item><item>
		<title>By: Blue Buddha</title>
		<link>http://ask.metafilter.com/46388/How-to-make-radio-box-be-selected-when-user-enters-accompanying-text#707890</link>	
		<description>Thanks apark! I changed the onFocys to onChange and that did the trick when going to the next question.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.46388-707890</guid>
		<pubDate>Tue, 12 Sep 2006 12:06:16 -0800</pubDate>
		<dc:creator>Blue Buddha</dc:creator>
	</item><item>
		<title>By: darkpony</title>
		<link>http://ask.metafilter.com/46388/How-to-make-radio-box-be-selected-when-user-enters-accompanying-text#707894</link>	
		<description>&lt; script  text/javascript&gt;&lt;br&gt;
function setRadio()&lt;br&gt;
{&lt;br&gt;
document.getElementById(&quot;Cheese&quot;).checked=true&lt;br&gt;
}&lt;br&gt;
&lt; /script&gt;&lt;br&gt;
&lt;br&gt;
&lt; input  radio name=&quot;group1&quot; id=&quot;Butter&quot; value=&quot;Butter&quot; checked&gt; Butter&lt;br /&gt;&lt;br&gt;
&lt; input  radio name=&quot;group1&quot; id=&quot;Cheese&quot; value=&quot;Cheese&quot;&gt; Cheese&lt;br /&gt;&lt;br&gt;
&lt; input  &apos;text&apos; name=&quot;other&quot;  setradio(); /&gt;&lt;/&gt;&lt;/&gt;&lt;/&gt;&lt;/&gt;&lt;/&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.46388-707894</guid>
		<pubDate>Tue, 12 Sep 2006 12:07:24 -0800</pubDate>
		<dc:creator>darkpony</dc:creator>
	</item><item>
		<title>By: Doofus Magoo</title>
		<link>http://ask.metafilter.com/46388/How-to-make-radio-box-be-selected-when-user-enters-accompanying-text#707896</link>	
		<description>The first example in the link you gave would work; just take out the &quot;blur,&quot; which removes the focus from the form element (which obviously would prevent you from ever typing anything there):&lt;br&gt;
&lt;br&gt;
&amp;lt;INPUT TYPE=&quot;TEXT&quot; onFocus=&quot;document.formName.radiobutton.checked=true&quot;&amp;gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.46388-707896</guid>
		<pubDate>Tue, 12 Sep 2006 12:08:06 -0800</pubDate>
		<dc:creator>Doofus Magoo</dc:creator>
	</item><item>
		<title>By: darkpony</title>
		<link>http://ask.metafilter.com/46388/How-to-make-radio-box-be-selected-when-user-enters-accompanying-text#707897</link>	
		<description>shoot something got lost in the input:&lt;br&gt;
onfocus = &apos; setradio();&apos;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.46388-707897</guid>
		<pubDate>Tue, 12 Sep 2006 12:08:17 -0800</pubDate>
		<dc:creator>darkpony</dc:creator>
	</item><item>
		<title>By: apark</title>
		<link>http://ask.metafilter.com/46388/How-to-make-radio-box-be-selected-when-user-enters-accompanying-text#707946</link>	
		<description>You&apos;re welcome!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.46388-707946</guid>
		<pubDate>Tue, 12 Sep 2006 13:00:58 -0800</pubDate>
		<dc:creator>apark</dc:creator>
	</item><item>
		<title>By: AmbroseChapel</title>
		<link>http://ask.metafilter.com/46388/How-to-make-radio-box-be-selected-when-user-enters-accompanying-text#708096</link>	
		<description>Two points:&lt;br&gt;
&lt;ol&gt;&lt;li&gt;if it&apos;s a button all by itself, which simply registers yes or no, then it should be a checkbox not a radio button -- radios are for mutually-exclusive options&lt;li&gt;what&apos;s the point of this? If the test is simply &quot;is there anything in the text box or not&quot; you don&apos;t need a separate checkbox, do you? You just need a check for content in the text box.&lt;/li&gt;&lt;/li&gt;&lt;/ol&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.46388-708096</guid>
		<pubDate>Tue, 12 Sep 2006 14:52:45 -0800</pubDate>
		<dc:creator>AmbroseChapel</dc:creator>
	</item><item>
		<title>By: mbrubeck</title>
		<link>http://ask.metafilter.com/46388/How-to-make-radio-box-be-selected-when-user-enters-accompanying-text#708225</link>	
		<description>Ambrose, see the original poster&apos;s question for an explanation of the use case (a set of radio buttons, one of which has an associated text field).</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2006:site.46388-708225</guid>
		<pubDate>Tue, 12 Sep 2006 17:29:10 -0800</pubDate>
		<dc:creator>mbrubeck</dc:creator>
	</item>
	</channel>
</rss>
