Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkbox access from document.form hierarchy

Status
Not open for further replies.

craiogram

MIS
Feb 20, 2004
126
US
On my page 1 I have 5 checkboxes. 2 and 4 are checked/disabled based on data from the database. User checks off checkbox 5 and clicks submit.

on page 2 I want to use request.form to see the newly checked checkbox BUT I also need to keep track of the already checked checkboxes for an if statment. Problem is the disabled check boxes don't send any info on submit. Therefore I want to create a function on my submit "onsubmit='return enableboxes();'" to enable the boxes. HOWEVER when I try to create the function I can't use
Code:
document.formAthruF."checkbox"
because the checkbox name does NOT appear in the list and I think it is because I have server-side coding in the checkbox input tag, see below. Can anybody help?? Here the the check box code.
Code:
<FORM action="checkentries.asp" onsubmit='return enableboxes();' method=POST id=formAthruJ name=formAthruJ>
<input type="checkbox" Name="A1" <% if row1RS("col1")="SOLD" then Response.Write "CHECKED DISABLED" %>>A1
<input type="checkbox" Name="A2" <% if row1Rs("col2")="SOLD" then Response.Write "CHECKED DISABLED" %>>A2
<input type=submit name=submit value=Submit>
<input type=reset name=reset>
</FORM>
Any help would be greatly appreciated.
 
If 2 and 4 are already clicked based on database information, why can't you simply call that same database information on page 2 along with the newly acquired info from the submission of page 1 to create your if statement? This would negate the need for you to do any of what you are asking about in your original post.

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Thank you Chopstik! I hadn't thought of it like that.

I will do! Thank you again for the conceptual clarity!
 
The browser has no idea that you have server side script that creates your HTML form elements. All the browser ever sees is the text stream... same as if it came from a static file.

Also, what do you mean by this: "checkbox name does NOT appear in the list"

 
The op should read carefully what has been advised. You open up new thread leaving all the correct advice behind and repeat the question.

You have been advised by cLFlaVA to use readonly attribute in the previous thread of substantially the same subject. Should you have really tried and reported back what does not work, he would have been recalled on a little bug for most browser on readonly attribute applied to radio and checkbox input tags.

Here is the workaround.
[tt]
>Response.Write "CHECKED DISABLED" %>>A1
Response.Write "CHECKED [red]onclick=""this.checked=!this.checked""[/red]" %>>A1
>Response.Write "CHECKED DISABLED" %>>A2
Response.Write "CHECKED [red]onclick=""this.checked=!this.checked""[/red]" %>>A2
[/tt]
which are the workaround of the bug on readonly attribute.
[tt]Response.Write "CHECKED [red]READONLY[/red]" %>>A1 'failed due to bug[/tt]
[tt]Response.Write "CHECKED [red]READONLY[/red]" %>>A2 'failed due to bug[/tt]

Or with less old-school flavour, you should do this.
[tt]
Response.Write "checked=""checked"" onclick=""this.checked=!this.checked""" %>>A1
Response.Write "checked=""checked"" onclick=""this.checked=!this.checked""" %>>A2
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top