cancel button in html form

Discussion in 'Web Design, HTML And CSS' started by souri_sen, Jan 10, 2009.

  1. souri_sen

    souri_sen New Member

    Joined:
    Jan 7, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Hyderabad
    Hello all, I have a problem to create a form's cancel button. It will be appreciable if anybody help me.

    The code is about the cancel button, im actully making a form which has a cancel button. If the button is pressed it will redirect in another page.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Write the code in the OnClick Event to redirect the page to other url. Something similar to the Go Advanced button in the quick reply
     
  3. skp819

    skp819 New Member

    Joined:
    Dec 8, 2008
    Messages:
    89
    Likes Received:
    3
    Trophy Points:
    0
  4. vks21

    vks21 New Member

    Joined:
    Feb 25, 2009
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    I am not sure about this But you should try it yourself..perhaps it works correctly..Good luck.
    Code:
    [FONT=monospace]
    [/FONT]object.Cancel
    
     
  5. akshits

    akshits Guest

    Below is a code help for you:-

    Code:
    
    <script>
    function $(id) { return document.getElementById(id); }
    </script>
    
    <form action="...php" id="frm">
    
    [CODE here]
    
    <input type="submit" value="Submit form">
    <button onclick="$('frm').action='otherPage.php';$('frm').submit();">Cancel</button>
    
    [CODE here]
    
    </form>
    
    
    Regards,
    Akshit Soota
     
    shabbir likes this.
  6. akras14

    akras14 New Member

    Joined:
    Aug 4, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    <input type="button" name="Cancel" value="Cancel" onclick="window.location = 'yourpage.html' " />
     
  7. GreatGizzards

    GreatGizzards New Member

    Joined:
    Nov 24, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    <a href="url.html"><input type="button" name="cancel" value="Cancel" /></a>

    This ones particularly nice because it only depends on html
     
  8. a-nerd-in-time

    a-nerd-in-time New Member

    Joined:
    Dec 19, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    GreatGizzards, thank you!
    works perfectly and I also wanted to mention that I needed to re-direct to a php file to instead of url.html, I entered home.php and bingo, it worked.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice