Is the following script possible in asp technology

Discussion in 'ASP General' started by Jack, Feb 25, 2005.

  1. Jack

    Jack Guest

    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>
    Jack, Feb 25, 2005
    #1
    1. Advertising

  2. Jack

    Tim Williams Guest

    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" <> wrote in message
    news:...
    > 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, Feb 25, 2005
    #2
    1. Advertising

  3. 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" <> wrote in message
    news:...
    > 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], Feb 26, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Harvey

    Is the following possible?

    Simon Harvey, Feb 23, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    270
    Eric Lawrence [MSFT]
    Feb 23, 2004
  2. Markis Landis Gardner
    Replies:
    1
    Views:
    270
    Rudi Angela
    Feb 26, 2004
  3. Victor Bazarov
    Replies:
    7
    Views:
    400
    James Kanze
    May 6, 2007
  4. Catherina Svensson
    Replies:
    0
    Views:
    365
    Catherina Svensson
    May 18, 2008
  5. Ben (Melb, Vic, Aus)

    Is it possible to acheive the following using a DataGrid in ASP.NE

    Ben (Melb, Vic, Aus), Sep 7, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    140
    Steven Cheng[MSFT]
    Sep 12, 2005
Loading...

Share This Page