|
From: shapper on 24 Jun 2008 19:01 Hello, On a bottom of a form I have 2 buttons: Submit and Cancel. Submit is an input and submits the form. Cancel should just redirect the user to a new page without submitting the form. I need the Cancel button to look the same as the Submit button. If I use an input of type button as Cancel button I am able to do that but then I need to rely on "onclick" to redirect the user ... I think would be better to use an anchor. However, I am having a problem in styling the anchor to make it look the same as the Submit input. Could someone tell me how to style the anchor and if using an anchor is better then using the button? My code: http://www.27lamps.com/Labs/Buttons/Buttons.html Thanks, Miguel
From: Jonathan N. Little on 24 Jun 2008 19:50 shapper wrote: > Hello, > > On a bottom of a form I have 2 buttons: Submit and Cancel. > > Submit is an input and submits the form. > Cancel should just redirect the user to a new page without > submitting the form. > > I need the Cancel button to look the same as the Submit button. > If I use an input of type button as Cancel button I am able to do that > but then I need to rely on "onclick" to redirect the user ... I think > would be better to use an anchor. Or you can have the "cancel" button in another form that submits "nothing" to that other page <form action="scriptThatDoesDomething.php"> .... <input type="submit" value="Submit Form"> </form> <form action="theOtherPage.php"> <input type="submit" value="Cancel"> </form> -- Take care, Jonathan ------------------- LITTLE WORKS STUDIO http://www.LittleWorksStudio.com
From: shapper on 24 Jun 2008 20:52 On Jun 25, 12:50 am, "Jonathan N. Little" <lws4...(a)central.net> wrote: > shapper wrote: > > Hello, > > > On a bottom of a form I have 2 buttons: Submit and Cancel. > > > Submit is an input and submits the form. > > Cancel should just redirect the user to a new page without > > submitting the form. > > > I need the Cancel button to look the same as the Submit button. > > If I use an input of type button as Cancel button I am able to do that > > but then I need to rely on "onclick" to redirect the user ... I think > > would be better to use an anchor. > > Or you can have the "cancel" button in another form that submits > "nothing" to that other page > > <form action="scriptThatDoesDomething.php"> > ... > <input type="submit" value="Submit Form"> > </form> > > <form action="theOtherPage.php"> > <input type="submit" value="Cancel"> > </form> > > -- > Take care, > > Jonathan > ------------------- > LITTLE WORKS STUDIOhttp://www.LittleWorksStudio.com Is this usually done? Having a form just redirecting to a page? However, I have a problem: I need to place both buttons side by side and in that case I think it will not be possible. Finally, could I place a input of type button inside an anchor? What do you think? Thanks, Miguel
From: Jonathan N. Little on 25 Jun 2008 09:14 shapper wrote: > On Jun 25, 12:50 am, "Jonathan N. Little" <lws4...(a)central.net> wrote: >> shapper wrote: >>> Hello, >>> On a bottom of a form I have 2 buttons: Submit and Cancel. >>> Submit is an input and submits the form. >>> Cancel should just redirect the user to a new page without >>> submitting the form. >>> I need the Cancel button to look the same as the Submit button. >>> If I use an input of type button as Cancel button I am able to do that >>> but then I need to rely on "onclick" to redirect the user ... I think >>> would be better to use an anchor. >> Or you can have the "cancel" button in another form that submits >> "nothing" to that other page >> >> <form action="scriptThatDoesDomething.php"> >> ... >> <input type="submit" value="Submit Form"> >> </form> >> >> <form action="theOtherPage.php"> >> <input type="submit" value="Cancel"> >> </form> <snip signature> > Is this usually done? Having a form just redirecting to a page? > However, I have a problem: I need to place both buttons side by side > and in that case I think it will not be possible. Sure you can, careful markup style as you need to... > > Finally, could I place a input of type button inside an anchor? What good would that do? -- Take care, Jonathan ------------------- LITTLE WORKS STUDIO http://www.LittleWorksStudio.com
From: Jonathan N. Little on 25 Jun 2008 09:42
shapper wrote: > Is this usually done? Having a form just redirecting to a page? Why not, works with no JavaScript. If there are no form inputs there is not data and the form action works like a link. The action can be a static HTML document > However, I have a problem: I need to place both buttons side by side > and in that case I think it will not be possible. I'll take pity on you and show you one example... One extra DIV and two CSS rules. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <meta http-equiv="content-language" content="en-us"> <title>One Way</title> <style type="text/css"> div.wrapper { position: relative; min-width: 15em; } div.wrapper form.nogo { position: absolute; right: 0; bottom: 0;} </style> </head> <body> <div class="wrapper"> <form action="someScript.php"> <fieldset> <label for="foo">FOO: </label> <input type="text" name="foo" id="foo" size="30"> </fieldset> <fieldset> <label for="bar">BAR: </label> <input type="text" name="bar" id="bar" size="30"> </fieldset> <fieldset> <label for="bar">BAZ: </label> <input type="text" name="baz" id="baz" size="30"> </fieldset> <div> <input type="submit"> </div> </form> <form action="someOtherPage" class="nogo"> <div> <input type="submit" value="Cancel..."> </div> </form> </div> </body> </html> -- Take care, Jonathan ------------------- LITTLE WORKS STUDIO http://www.LittleWorksStudio.com |