Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts

    html button help needed?

    hi, i want to have a button that says next and will only work if the checked box on top of it is checked. Does anyone know how to do this?
    THanks

  • #2
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    in the function that the next button calls, you can just check if the checkbox is checked:

    Code:
    <input type="button" onclick="func();" />
    
    <script type="text/javascript">
    function func()
    {
      if (document.form1.buttonCheckbox.checked)
      {
        doWhatever;
      }
    }
    </script>

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts
    doesnt really make sense is this the whole code? or do you want me to right things in it?

  • #4
    Regular Coder
    Join Date
    Mar 2006
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, an example of it would be like the agree form we use here to register.

  • #5
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    well, what does the button do?

    A button that says next doesn't actually do anything when you click it. You have to tell it what to do.

    So yes, you need to fill things in.

  • #6
    Regular Coder
    Join Date
    Mar 2006
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts
    im am goign to list all my rules then, when you check in the box that you agree then you click a button called next which will take you to a different page. If you dont check the box and when you try to click next it i dont want it to work.

  • #7
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    so where I have doWhatever, you put the code that the button is supposed to execute.

  • #8
    Regular Coder
    Join Date
    Mar 2006
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts
    could you give me an example of the button code?

  • #9
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    document.signupform.submit; ??

    I mean, I don't know what you want to do. Submit a form? Calculate the total cost of the order form? Send an ajax call to validate their data? Do you see my dilemma? I have NO idea what you want beyond "the button not working unless the checkbox is checked". I got that for you, now you gotta make it work when the checkbox IS checked.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •