|
-
Aug 6th, 2001, 01:29 PM
#1
Thread Starter
Frenzied Member
Checkboxes
I have a site built in ASP & Javascript where part is like a address book and there are checkboxes off to one side with lables like "Email List" or "Do Not Fax". I am having trouble designing how they work. I am storing the data in a database. If anyone has done anything like this or has some ideas please let me know.
Thanks in advance,
Michael
-
Aug 6th, 2001, 02:42 PM
#2
well all though I ain't that big on ASP I would think it is almost the same as far as variables are concerned.
ok you have those checkboxes and you asign them a name.
eg <input type=checkbox name=emaillist >
and then when you go to another page you check to see if that check box has been checked. so in your other script you check for it like so--
if $emaillist=""
then do something
else
load the mail list page so they can sign up.
does this make since. or are you stuck on some thing else.
-
Aug 6th, 2001, 03:29 PM
#3
Fanatic Member
The value of checked for the checkboxes returns either true or false. How are you storing these values?
If these values are true and false you can load the page like this:
Code:
....
bEmail = RS.fields("EmailList")
bNoFax = RS.fields("NoFax")
If bEmail Then
%>
<input TYPE = "checkbox" NAME = "chkEmail" CHECKED>
<%Else%>
<input TYPE = "checkbox" NAME = "chkEmail">
<%
End If
If bNoFax Then
%>
<input TYPE = "checkbox" NAME = "chkNoFax"CHECKED>
<%Else%>
<input TYPE = "checkbox" NAME = "chkNoFax">
<%End If
...
To retrieve these values on the client side use:
var bEmail = document.yourForm.chkEmail.checked;
var bNoFax = document.yourForm.chkNoFax.checked;
I'm not totally sure about the form retrieval though try:
bEmail = Request.form("chkEmail")
bNoFax = Request.form("chkNoFax")
Last edited by Psyrus; Aug 6th, 2001 at 03:39 PM.
-
Aug 7th, 2001, 08:27 AM
#4
Frenzied Member
Actually, checkboxes only send values that are checked. And the value on a checkbox is independent of whether or not it is checked.
In other words, if you have three checkboxes you can set their values to whatever you want. Then if you check #1 and #3, only #1 & #3's values will be passed in the form collection to the next page.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Aug 7th, 2001, 08:44 AM
#5
Thread Starter
Frenzied Member
i am sending the data to a hidden fram to do my calculations and "pseudo-refreshing" the items that need refreshing using outer-html. I am transfering values of the form values with onblur & onclick (depending on the item) via the url sent to the hidden frame. I have a javascript procedure run through all the items to get their "value" and adds to a string which I add to the url. this all works fine untill I factor in checkboxes.
right now I have added to the 'url building' function a routine that looks to see if the item is 'checked', if it is then I send over the value of "Y" if not then I just send the "value". Of course all input & textarea are unchecked so they send the value (which is what I want) and unchecked boxes send the default value of "on". From here I need for it to go into the database and also beable to do the reverse.
I have put this section of my project on hold for a few days but hope to be back to work on it soon.
Thanks to everyone who has posted, and advance thanks to everyone who will 
Michael
-
Aug 8th, 2001, 01:15 PM
#6
Thread Starter
Frenzied Member
OnFocus
I've gotten most of my problems with the check boxes figured out and now I think I am down to the last one. The problem is...
I have OnBlur & OnFocus events on each of the checkboxes. It is Supposed to go to a function when the user clicks on the box and preform another function when the user clicks off. (I have this set on every other element on this form and it works fine). The problem is that it only works for the very last chkbox. Code below.
thanks in advance,
michael
<input type="checkbox" name="PROCHKtravelagent" TABINDEX="34" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'IStravelagent\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKweblinkpartner" TABINDEX="35" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISweblinkpartner\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKbookingagent" TABINDEX="36" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISbookingagent\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKguestbooked" TABINDEX="37" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISguestbooked\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKguestmailing" TABINDEX="38" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISguestmailing\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKhoneymoon" TABINDEX="39" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'IShoneymoon\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKhotel" TABINDEX="40" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'IShotel\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKpress" TABINDEX="41" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISpress\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKvendor" TABINDEX="42" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISvendor\')" style="background-color: #d0d0ec>"
<input type="checkbox" name="PROCHKairline" TABINDEX="43" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISairline\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKmemberhotel" TABINDEX="44" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISmemberhotel\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKmemberresdesk" TABINDEX="45" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISmemberresdesk\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKtv" TABINDEX="46" TABINDEX="46" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'IStv\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKgov" TABINDEX="47" TABINDEX="47" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISgov\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKdonotfax" TABINDEX="48" TABINDEX="48" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISdonotfax\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKnogrpemail" TABINDEX="49" TABINDEX="49" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISnogroupemail\')" style="background-color: #d0d0ec">
<input type="checkbox" name="PROCHKmember" TABINDEX="50" TABINDEX="50" onBlur="profileModify(\'Modify\')" onFocus="profileHasFocus(\'ISmember\')" style="background-color: #d0d0ec">
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|