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.

Java Script...I think

  • 14-03-2008 11:42AM
    #1
    Closed Accounts Posts: 41


    Ok.... well im in college working on a project using asp vbscript. i need to have a dynamic form that starts with like four textfields and 2 radio buttons and once one of the radio buttons has been checked, I need either 2 more textfields or if the other one is checked three more textfields to appear on screen. each of the textfields need to have different labels too. :eek:

    so i was fishing around for answers and trying myself to write some sort of code using asp, and trying a a lil bit of java script but it hasnt worked out well so far. All i need is a push in the right direction then ill be flying so if theres anyone that can help that would be great.


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    You really need to post some code if you want an answer, have a read of this and follow those guidelines everywhere you're asking a question online.


  • Closed Accounts Posts: 41 greentoymonkey


    <script language="JavaScript">
    <!--
    if (RadioGroup1, checked = 0)
    {
    
     Test
                <input type="text" name="textfield" />
    }
    //-->
    </script>
    

    this is my attempt at the javascript but its giving me an error on the webpage of a syntax error


  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    Hmmm I need to make dynamic form fields - think I'll try google

    http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&gfns=1&q=dynamic+form+fields

    quel suprise!


  • Registered Users, Registered Users 2 Posts: 6,342 ✭✭✭OfflerCrocGod


    <script language="JavaScript">
    <!--
    if (RadioGroup1, checked = 0)
    {
    
     Test
                <input type="text" name="textfield" />
    }
    //-->
    </script>
    

    this is my attempt at the javascript but its giving me an error on the webpage of a syntax error
    That's because it's totally wrong. What you must do is have the elements in the web page but hide them with CSS display: none then using onclick() you call a function that brings the hidden objects to view by changing their style values.

    If you want to do web development I highly recommend using Firebug and watching the Yahoo video on using it by Joe Hewitt. It's an invaluable tool for this kind of development.


  • Closed Accounts Posts: 41 greentoymonkey


    some great tips there lads thanks...really appreciate it


  • Advertisement
Advertisement