For Programmers: Free Programming Magazines  


Home > Archive > ASP > February 2005 > Is the following script possible in asp technology









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Is the following script possible in asp technology
Jack

2005-02-25, 8:55 pm

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>

Tim Williams

2005-02-25, 8:55 pm

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.


"Jack" <Jack@discussions.microsoft.com> wrote in message
news:1FED87F2-D9A2-40F8-BB75-CAF9019A3535@microsoft.com...
> 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>
>



Ray Costanzo [MVP]

2005-02-26, 3:55 am

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

"Jack" <Jack@discussions.microsoft.com> wrote in message
news:1FED87F2-D9A2-40F8-BB75-CAF9019A3535@microsoft.com...
> 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>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com