Is the following script possible in asp technology

J

Jack

Hi,
I have the following javascript that is written in html. It works great.
However, I need to transfer the concept to an asp application where the form
itself is an asp page. I was wondering if that is possible to do? Thanks in
advance.
Regards

PS: In the html page the following comes intuitively(using Visual Interdev).
However, in the asp page it does not. e.g after document.formname. the
checkbox name does not show up in the asp page.
On the other hand the following comes intuitively in an html page
document.formname.checkboxname.checked

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>

<SCRIPT LANGUAGE="JavaScript"><!--
function codename() {

if(document.formname.checkboxname.checked)

{

document.formname.textname.disabled=true;
document.formname.checkboxname.disabled = true;
}

else
{
document.formname.textname.disabled=false;
document.formname.checkboxname.disabled = false;
}
}

//-->
</SCRIPT>

<form action="" method="" name="formname">

<input type="text" size="10" name="textname">

<input type="checkbox" onclick="codename()" name="checkboxname" value="OFF">

<input type="submit" value="Add">

<input type="reset" value="Clear">

</form>


</BODY>
</HTML>
 
T

Tim Williams

To turn that into an ASP page you would just save it as [pagename].asp
Viola!

Seriously though - what do you want the ASP page to do? Are you asking
about coding your form validation script in ASP instead of client-side js?
VS is not going to get you there without some amount of reading....

Tim.
 
R

Ray Costanzo [MVP]

Hi Jack,

Something like this, maybe?

<%
Dim bChecked
bChecked = Request.Form("checkboxname") <> ""
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>



<form action="" method="post" name="formname">

<input type="text" value="<%=Server.HTMLEncode(Request.Form("textname"))%>"
size="10" name="textname"<% If bChecked Then Response.Write "
disabled=""disabled"""%>>
<input type="checkbox" onclick="this.form.submit();" name="checkboxname"
value="OFF"<% If bChecked Then Response.Write " checked=""checked""
disabled=""disabled"""%>>
<input type="submit" value="Add">
<input type="reset" value="Clear">
</form>

</BODY>
</HTML>

Ray at home
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top