Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Fancy Form

  • 04-07-2002 11:48AM
    #1
    Registered Users, Registered Users 2 Posts: 771 ✭✭✭


    Ive got an ASP page with a form for registration.

    i want to implement a feature such that if a user clicks yes to one checkbox... then another form input type(say a dropdown box) is hidden, or greyed out?

    anyone done anything like this before, or able to point me in the right direction...?

    help!!! pretty please!!!


Comments

  • Registered Users, Registered Users 2 Posts: 19,396 ✭✭✭✭Karoma


    google.com


  • Registered Users, Registered Users 2 Posts: 19,396 ✭✭✭✭Karoma


    rough idea from something that i have lying around. try working things out first in future :mad: it won't hurt half as much as you might think.

    <script language='javascript'>

    document.myform.send.disabled = true;
    document.onkeyup = proces;
    document.onmouseup = proces;
    document.onmousedown = proces;

    function proces()
    {
    if (document.myform.name.value == '')
    {document.myform.send.disabled = true;}
    else
    {document.myform.send.disabled = false;}
    }
    </script>

    probably doesn't work properly,etc. mneh!


    ... and the HTML ::

    <html>
    <body>
    <form name=myform>
    <input type=text name=name onchange='doIt()'>
    <input type=button value="Send (test)" name=send onclick='javascript:alert("This is only a test! Dimwittedmutha!")'>
    </body>
    </html>


  • Registered Users, Registered Users 2 Posts: 771 ✭✭✭whiteshadow


    eh.. thanks but..that's just a javascript popup msg to make sure that all form fields are filled..


  • Registered Users, Registered Users 2 Posts: 14 bar


    something like this?

    will need to be tweaked for netscape, but this should get you started


    <html>
    <head>
    <title>Nothing</title>
    <script language="javascript">

    function hidetextbox()
    {
    var cb = document.all.checkboxone;
    var tb = document.all.textboxone;
    if (cb.checked)
    {
    tb.disabled = true;
    tb.style.background = "#dddddd";
    }
    else
    {
    tb.disabled = false;
    tb.style.background = "#ffffff";
    }
    }

    </script>
    </head>

    <body bgcolor="#FFFFFF">
    <form method="get" action="whatever">
    <p>Check Box : <input type="checkbox" name="checkboxone" value="checkbox" onclick="hidetextbox()"></p>
    <p> Text Box : <input type="text" name="textboxone"></p>
    </form>
    </body>
    </html>



    bar


Advertisement