Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    ASP




Checkbox And Javascript


I have a JavaScript function that gets a boolean value and checks or unchecks a checkbox based on the boolean value.

function initialize_p(thevalue) {
if (thevalue) {
document.form.cbx1.checked=true;

}
else {
document.form.cbx1.checked=false;

}

In the example, I want form.cbx1 to be checked if 'thevalue' is true and unchecked if 'thevalue' is false. However, it's not working as desired. I used the alert stmt to see what it does:

- When 'thevalue' is true, it goes to the 1st part of the if stmt and checks the checkbox.
- When 'thevalue' is false, it still goes to the 1st part of the if stmt and checks the checkbox

It looks it never goes to the else!! I used alert stmts to see where it goes if the 'thevalue' is false (used alert to show me the value of 'thevalue' and where it is in the if stmt). I don't understand what's going on. Can anybody see what is wrong with the function?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Checkbox Value?
is there a way of having a dropdownlist and a text field with a checkbox so that you can check a box and have the vaule assigned from a option selct list or check another box and have the value assigned from a textfield?

Asp And Checkbox
I would like to make an interaction with a database using ADO and SQL. I would like to display some parts of the database using checkboxes to choose the different parts. But I don't know how to build the SQL command in fuction of which checkbox is checked.

Checkbox
I am new born kid of this block and want some help from my seniours.
I am populating the few fields values from one of the table. I put series of checkbox having same name but have a different value ( value of checkbox is small int, an autoincrement field of table).
I have to take action against the selection of checkboxes. If the user check one of the checkboxes and select "Approved the things " then the USER will move to some else page and the selection will Approve.
On the contrary, if the user opt delete the things then user move to other page and record will be delete from the table.
Now my problems is...
1) how can I know which checkbox user selected ?
2) Are there someway to get the value of checkbox without making form ?

Checkbox
i have a update page the pulles date form a database. and two the these
fields have Y or N in them and if the RS("Value") = Y the i want the
checkbox to be checked how do i do this??

Checkbox
I know this is gonna sound silly but when I submit a form with a checkbox
html control "mychk", how can I see if that is checked or not ?

I have tried :

if request.form("mychk") = true then
' code
else
' code
end if

But it always executes the code in the else statement meaning it is never
true despite the fact I have given the checkbox a value of true.

Checkbox Value
how to write sql to give value true in db?

If Else Using Checkbox Value
I have a checkbox which is used to determine whether or not the user wants to display a map of their business with their listing the value of which is being written into a database.

When I am outputting the listings I am just trying to use a simple if else statement

i.e. If(ShowMap = true)Then
Response.Write("<td>Show Map</td>")
Else
Response.Write("<td>No Map</td>")
End If

Problem is I know the database contains different values for ShowMap i.e. some true, some false. Yet when I use this code, No Map is output for all records.

Checkbox
I populate my checkboxes in a table written in asp. Each checkbox has the same value but a different name. I want to say for checkbox in the asp table, call a procedure that will do the changes. Code:

Using A Checkbox
I have a profile search where people can search through our dating profiles. I want to add a checkbox which when checked filters out those records where the recordfield pictures is empty.

I have problems figuring out what the checked value of the checkbox should be and how to use the information from the checkbox in the searchresults page to build the record set. For understanding, if a user does not have a picture the picture field is empty.

Value In Checkbox
I am trying to display the value of a true/false value in my table through the use of the following:

<input type=checkbox name=FieldLabCheck value=" &
objRecordset("FieldLaborSuper") & "></input>

it doesn't work though.... what am I doing wrong.

Value Of Checkbox
I have a checkbox in a form from which I want to collect the value.
<input type="checkbox" name="Question11a" value="a">

In the asp page that is called on submit of the form, I declare a variable, iQuestion11a, and request the value of this checkbox:
iQuestion11a = Request("Question11a")

When I print out the value to an html page <% response.write(iQuestion11a) %> it is empty.

Checkbox Set To OFF
When using checkboxes on a form, if you uncheck them, the unchecked name/value pair in the Request.Form collection doesn't show up. It only shows when the checkbox is set to ON. Is this correct? What's the workaround if it is?

Checkbox With Textbox
anyone have any idea how to do checkbox with textbox beside.

Checkbox Disable
if i want to display many records from database with each record has one checkbox.. if the record do not meet the constraints.. e.g. if supplier name has no email address.. then that checkbox will be disabled....the rest will appear.. i tried the disabled/// but no result.

How To Update Checkbox !!
I have problem in updating checkbox (true-false) using SQL statement.

Checkbox And Two Variables
I need to assciate two varaibles dyanmically in value of the checkbox.
How can I do that? For ex., I have the following:

<td><input type='checkbox' name='chk<%=i%>' value='<%=rs("Field1")%>'>

Above, I need to add second fields value from database in value
property of the checkbox.

Checkbox Vs Text Box
I have a form with multiple records.

My intention is to have the user click a checkbox for each product he wants.
Then submit the form placing multiple items in his cart.

If I use a text box like the following and enter a 1 for each product,
submit, no problem.

The user gets the products he wants.
<input name="qty" type="text" value="0">

However, if I use the following checkbox code, and assuming the user checks
4 products half way down the page, he will get the first 4 products in the
recordset. If he clicks 1 checkbox, he will always get the first product,
not the product he chose. <input name="qty" type="checkbox" value="1">

What I have found is when I submit the form to a blank test page using
checkoxes or text boxes, there's a considerable difference. The text boxes
deliver a comma delimination for each occurance. The checkboxes only offer
comma delimination for each checkbox that is selected. At this point, I'm
assuming that's the difference between the two and it cannot be changed
through HTML.

Checkbox Question
I have a sql database with bit datatypes and I am trying to create a asp
webform which will display and update the data from checkboxes.

Dynamic Checkbox
I have a table in ASP page which displays records and it has a checkbox whose name is ChkBox<%= intRecID %>

<%= intRecID %> is the ID of that record. Now how should I chck whether check box is not checked.

Checkbox Values
im not that good at asp, infact im using dreamweaver to make my pages up! what i would like to do is show a list of items and price in a table, with a checkbox next to them, the form is submitted and then on the next page i would like to display the the items that have been checked.
I think i have the first page sorted, i have linked the checkbox to the product ID value in the database, so i can pass that value to the next page. the problem is the second page, i can get it to show the values of the checkbox (eg items 1, 4 ,26...) but only the numbers.How do i go about using this value (number) to pull the rest of the data from the table (stored in a mdb)?

im using this in the first page form to pass the checkbox value
<input type="checkbox" name="checkbox" value="<%=(rs_stock.Fields.Item("ID").Value)%>">

on the second page i get the values get shown with
<%= Request.Form("checkbox") %>
im at a loss on how to do this

Return A Checkbox
How do I return the true/false value from the database to be either a checked or unchecked box using ASP?

Checkbox Required
Anyone know how to make a checkbox required in a form?

Dealing With Checkbox
I want to design a page which has lots of criteria on which I want to be selected by using checkbox's. I then want to pass only the criteria that have been checked and store them in an Access DB, and leave the items that have not been ticked alone.

Anybody any ideas?

Update Db With Checkbox Value
I want to use a check box to update a field if it is checked. I have:

<input name="expr_date" type="checkbox" id="expr_date" value="<%=newExprDate%>" />

this doesnt work in either way - the record field stays the same if the box is checked or unchecked.

Is this possible - where am I going wrong?

Checkbox Updating A DB
I'm trying to add a checkbox to a form which updates a DB (access). Dreamweaver generated this and then doesn't work.

<input <%If (CStr((RS_UpdateProfile.Fields.Item("fldReadTerms").Value)) = CStr("true")) Then Response.Write("checked=""checked""") : Response.Write("")%> name="fldReadTerms" type="checkbox" id="fldReadTerms" value="-1" />

This checkbox doesn't update the database nor does it display the value in the field in the table.

As I grow to hate dreamweaver by the day I still am not any closer to solving my little problem.

Checkbox In Repeater
I use a Checkbox in a Repeater, how can I know which Checkbox have changed in OnCheckedChanged?

I have tried to set id then checkbox is binding data, but it will not work.

ASP/Checkbox Array
I have a form with checkbox array and I am using the database to give uniqe values to the checkboxes. This form shows some of the checkboxes are already checked based on certain criteria.

When the user checks the check boxes I am able to get the ids of that record and be able to update the database. But when the users uncheck the check box that already checked, I am not getting anything when I do response.write. So I have no way of knowing which check box is unchecked and so I can't update the database.

Is there anyway I can get the values of the unchecked checkboxes? Or there any method that I can use to make my form work?

Checkbox Combine
I want to let users select one or more of my 5 choices in checkbox format, but also want to have a choice that is "all 5 choices". When "all 5 choices" is selected, I want to make sure they can't check any of the 5 choices. Is this possible?

Readonly Checkbox In ASP
how can we set the checkbox to readonly mode so that its state can't be changed by the user. i used readonly = true but its not working. remember, i am doing this is ASP.

HUGE Checkbox
i have a single ASP page with an access DB, no separate html page involved.This ASP page searches the database and displays all the fields by default, then a user can select certain information they would like to narrow it down to. I have all the text based search working, i can display textbox checked based on the value stored in the access DB.
now my only part left is how do i create a TEXTBOX on the ASP form, where when a user checks it off it will only show the data that has that particular checkbox checked,
this is what the page look like
http://e.domaindlx.com/kaztro/sample.asp

Simple Checkbox To / From DB
I have a form that only has one check box in it for active / inactive. This form is when viewing a member record. My 2 questions are:

How do I get the checkbox into the form showing the state that it is in the database? - I can get a check box to show, but can not get it to show ticked / not ticked according to the database Code:

How To Use The Checkbox In ASP Code ?
<input type="checkbox" name="c1" value="c1" />

<%if request.form("c1") = "c1" then
response.write ("Hi I am checked")
else
response.write ("Hi I am not checked")
end if
%>

<input type="submit" name="b1" value ="submit">

what I want : if the check box checked print ("Hi I am checked")
else print "Hi I am not checked"

Checkbox Problem
In my previous program, I make 1 drop down menu which consist of author, dates, category,etc.

If it looks like that, I just need 1 variable which is name of drop down menu.

Now, I was asked to make like this: I have some check box which are: check box for author, check box for dates, check box for category, etc.

If I tick author, and type keyword "xyz" then the program only search for keyword "xyz" in scope author. The same condition if I want to tick author, category and title with keyword "xyz". Then, the program only search for keyword "xyz" in scope author, category and title. Code:

Checkbox Question
I have a script that will work on it is own, but the problem is the site I
am trying to implement the checkbox on a site with attachments on the same
form. In my testing I check LOW. Code:

Asp: Delete Using Checkbox
I have an asp page that will delete using checkbox. This checkbox I have assigned the username field as the delete refference.

value="'<%=viewLec("username")%>'">

But now..I want to assign an no field to the checkbox as the delete refference, but it did not works!!!

value="<%=viewLec("no")%>">

I think it has to do something with my delete sql command! Code:

Checkbox Asp Update
i've encountered a problem.. which is that when i update the checkbox field, the previous checkbox updates are gone.. how can i go about editing it? Code:

Session Checkbox
So, when the submit-button is clicked and only 1 checkbox is checked, no problem
the page returns and that checkbox is checked. But when 2 are 3 or ... checkboxes are checked and the page returns none of the checkboxes are checked so I want that the checkboxes who were checked are still be checked after rebuilding the page.

I've put a response.write session("city") and the output is (for example), brussels, antwerp, london

of course it won't work because
If Session("city") = "brussels" Then....
and the session isn't brussels, but
brussels, antwerp, london

so I think that the session must be "split" so afterwards I can check of the session is that city and the checkbox of that city must be checked.

Passing Checkbox Value
I have a simple problem:

page 1:
<input type=checkbox name=addValue value="Y">

page 2:
<input type="hidden" name="addValue" value="<%=Y%>">

page3:
<%=request.form("addValue")%>
<%if "addValue" = "Y" then addTax="30,00" else addTax="0,00" end if%>
<%=pCurrencySign & (addTax)%>

There is a problem in transfering the value from page 1 to page 2 and 3.

Readonly Checkbox
how can i set checkbox in readonly mode so that no one can change its state either to checked or unchecked. i used readonly = true but it isn't work. remember that i am doing it in ASP.

Dynamic Checkbox
I have a form with x amount of checkboxes called "majestic". But i only want the user to select one.How do i go about this in javascript or is there an asp alternative.

Checkbox Check
I added multiple checkboxes into a placeholder.How to I trigger a function,say checkbox_checked(),whenever one of the checkboxes check state is changed?ie. I don't want to have write separate functions for each of them

Check Checkbox
I need to set a checkbox to the "checked" state and prevent the user from unchecking it. I tried using "disabled", but then the value is not passed on the Post to an ASP page.

Checkbox Array
I have an ASP form that uses a recordset to build a table, with one of the columns containing a checkbox.Upon posting, the ASP code of the Post-To page uses the "For i = 1 to request.form("chkAddToInvoice").count" method to go through the array, but it only counts checked boxes.

Not only is this causing the corresponding Update statement to write values to the wrong records, it is preventing me from using the "False" value of the check box to run its corresponding Update statement.

Is there a way to set up the checkbox so that it is counted whether it is selected or not?

Enable A Checkbox
I need to enable a checkbox if text is entered into a text box.My Html is .Code:

<INPUT NAME="txtTextBox" SIZE=8 MAXLENGTH=8 TITLE="Title of text box">

What I am unsure about is the code for the vbscript. I currently have the following which I know is wrong.Code:

<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Sub txtTextBox_onclick
Document.form.chkCheckBox.enabled = True
End Sub
-->
</SCRIPT>

Display Checkbox
How do I get results of a database field to place a check in a check box on the results page…? I use frontpage and use check boxes in the submit form to give a Yes/No or True/False to the database… I want to create a results page that has the same look as the submit form and have the boxes checked when it receives the appropriate information (Yes/No or True/False) from the database.

Checkbox Checked
i m getting value of blnPermit is True .but still not show my checkbox as checked .alredy spent a hour for this. what i m missing? Code:


<input type="checkbox" class="checkbox" id="blnPermit" name="blnPermit" onClick="ChangeStatus()" <%if blnPermit then %>checked<%end if%>>dd

Get Checkbox Value In Paging
I have a table with checkbox in one field and itemname in another field.and i kept paging for that. How to get the checkbox value of all the checked item in paging .

What i mean is that suppose i checked a item in 1 st page and and then i checked another item in 3rd page now when i click save button in the bottom of the page i want these two checkbox value.

An ASP Checkbox Form
I have an asp page linked to a Microsoft Access database. On the first page I have a list with 10 or so names that belong to a group I simply get from the database with a sql code. The thing is I have a checkbox before every name of that list done with one simple code. Tell me if this can be done. Example.

The list is in html table.

Response.Write("<td align="left"><input id=rsnbap('id') type='checkbox' />")

It loops through the end of that group. I want to make this happen. Only the checked values (persons) from that list to appear listed in another page named userForm.asp .I'm sure it is all the asp basics.

Getting Checkbox Values
I have a page with a checkbox on it (chkMyBox). I want to be able to click on it and redirect the page back to itself, showing the box checked when it resubmitts. How can I do this?


Copyright © 2005-08 www.BigResource.com, All rights reserved