/    Sign up×
Community /Pin to ProfileBookmark

Does anyone have a script that will only allow you to check on check box at a time??

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliAug 18.2003 — I am sure you can use a script like tthe one at this resource.

http://www.webapplikations.com/pages/html_js/forms/CheckBoxesLimitUserSelection.html
Copy linkTweet thisAlerts:
@soccer362001authorAug 18.2003 — Thats what I want but where is the script??
Copy linkTweet thisAlerts:
@soccer362001authorAug 18.2003 — I've got another problem. I have many forms that I want sent to my email. And I have to separate theses forms in order for the script to work.
Copy linkTweet thisAlerts:
@soccer362001authorAug 18.2003 — Here it is if this helps.

[upl-file uuid=1ed5848a-030f-4a29-8060-ef42af1d0fe8 size=4kB]mailform.txt[/upl-file]
Copy linkTweet thisAlerts:
@Khalid_AliAug 19.2003 — There are few items in the html section that needed to be corrected.

Below is the corrected code for html part of copy and paste it

<i>
</i>&lt;form id="check" action="http://pub42.bravenet.com/emailfwd/senddata.php" method="post"&gt;
&lt;input type="hidden" name="usernum" value="3565748791" /&gt;
&lt;input type="hidden" name="cpv" value="2" /&gt;
&lt;table cellpadding="10" cellspacing="0" border="0" style="width: 400px; border:solid 1px #969696;" align="center"&gt;
&lt;tr&gt;
&lt;td width="50%" align="right"&gt;Enter Your Name:&lt;/td&gt;
&lt;td&gt;&lt;input type="text" name="sample" value="" size="20" maxlength="40"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr bgcolor="#f6f6f6"&gt;
&lt;td width="50%" align="right" style="border-top: solid 1px #969696;"&gt;Enter Your Email Address:&lt;/td&gt;
&lt;td style="border-top: solid 1px #969696;"&gt;&lt;input type="text" name="sample" value="" size="20" maxlength="40"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="border-top: solid 1px #969696;"&gt;
Did you find what you were looking for?&lt;br&gt;&lt;br&gt;

&lt;input type="checkbox" name="yes" onclick="add(this);"/&gt;Yes&lt;br/&gt;
&lt;input type="checkbox" name="no" onclick="add(this);"/&gt;No&lt;br&gt;
&lt;input type="checkbox" name="maybe" onclick="add(this);"/&gt;Maybe&lt;br&gt;
&lt;/td&gt;

&lt;td style="border-top: solid 1px #969696;"&gt;Do you like my site?&lt;br&gt;&lt;br&gt;
&lt;input type="radio" name="rate" value="absolutely" style="border:0px;"&gt; Absolutely&lt;br&gt;
&lt;input type="radio" name="rate" value="itsok" style="border:0px;"&gt; It's ok&lt;br&gt;
&lt;input type="radio" name="rate" value="idontcare" style="border:0px;"&gt; I don't care&lt;br&gt;
&lt;input type="radio" name="rate" value="itbad" style="border:0px;"&gt; It's bad&lt;br&gt;
&lt;input type="radio" name="rate" value="itstinks" style="border:0px;"&gt; It stinks&lt;br&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr bgcolor="#f6f6f6"&gt;
&lt;td align="right" style="border-top: solid 1px #969696;"&gt;Your favorite person in Texas History:&lt;/td&gt;
&lt;td style="border-top: solid 1px #969696;"&gt;
&lt;select name="sample" size="1"&gt;
&lt;option value="" SELECTED&gt;&lt;/option&gt;
&lt;option value="sh"&gt;Sam Houston&lt;/option&gt;
&lt;option value="jb"&gt;James Bowie&lt;/option&gt;
&lt;option value="dc"&gt;Davy Crockett&lt;/option&gt;
&lt;option value="sfa"&gt;Stephen F. Austin&lt;/option&gt;
&lt;option value="all"&gt;All of the above&lt;/option&gt;
&lt;option value="none"&gt;None of the above&lt;/option&gt;
&lt;option value="dontcare"&gt;I don't care&lt;/option&gt;
&lt;/select&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr &gt;
&lt;td colspan="2" align="center" style="border-top: solid 1px #969696;"&gt;&lt;textarea cols="40" rows="4" name="text"&gt;&lt;/textarea&gt;&lt;br&gt;&lt;br&gt;
&lt;input type="submit" name="submit" Value="Submit Form"&gt; <br/>
&lt;input type="reset" name="reset" value="Reset Form"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;


and delete this part of the code in the javascript part of the code( you do not need it)

if(ctr==allowedNumberOfSelections){

var str = "";

var z=0;

for(x=0;x<frm.length;x++){

if(frm[x].type=="checkbox" && frm[x].checked){

checkedArr[z++]=frm[x];

str+=("element name ["+frm[x].name+"]<br/>")

}

}

document.getElementById("msg").innerHTML = (str);

}
Copy linkTweet thisAlerts:
@soccer362001authorAug 19.2003 — Thanks it worked great.
Copy linkTweet thisAlerts:
@Khalid_AliAug 19.2003 — you are welcome...? ?
×

Success!

Help @soccer362001 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...