posting form using text link

Discussion in 'HTML' started by Michel, Oct 31, 2003.

  1. Michel

    Michel Guest

    Hi all,

    Wuold it be possible to post a form using a textlink instad of an image or
    (ugly) button?

    Thanks for the advice and a coding example.... in advance

    Michel
    Michel, Oct 31, 2003
    #1
    1. Advertising

  2. In article <bnu3qr$tu$>, says...
    > Hi all,
    >
    > Wuold it be possible to post a form using a textlink instad of an image or
    > (ugly) button?
    >
    > Thanks for the advice and a coding example.... in advance


    <a href="#" onClick="formName.submit();">Send</a>

    Won't work without JavaScript. Why do you want to do this?

    --
    Hywel I do not eat quiche
    http://hyweljenkins.co.uk/
    http://hyweljenkins.co.uk/mfaq.php
    Hywel Jenkins, Oct 31, 2003
    #2
    1. Advertising

  3. Michel

    Steve Pugh Guest

    "Michel" <> wrote:

    >Wuold it be possible to post a form using a textlink instad of an image or
    >(ugly) button?


    Why not use CSS to make the button look less ugly? You could even make
    it look like a text link.

    To submit a form with an <a> element would require JavaScript, which
    won't be available to all your visitors.

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
    Steve Pugh, Oct 31, 2003
    #3
  4. Michel

    Michel Guest

    Ey.... javascipt does cover 97,5% of my visitors (1800 daily) so I am not
    really seriously worried)

    I wanted this, to be able to do both multiple actions on submit, as well as
    changing the form action.
    Works flawlessly, by the way
    Look at the code:

    <SPAN ID="options" CLASS="menu">
    <FORM action="" METHOD="POST" NAME="menu">
    <INPUT TYPE="hidden" NAME="Sid" VALUE="">
    </FORM>
    <TABLE BORDER="0" CELLPADDING="3" CELLSPACING="0" BGCOLOR="#FFE07B">
    <TR><TD><A class="t"
    HREF="javascript:menu.action='add.php';menu.submit();"><?php echo $toevoegen
    ?></A></TD><TD rowspan=3 valign="top"><A
    HREF="javascript:setMenu('options')" onMouseOver="window.status='<?php echo
    $menu_weg; ?>';return true" onMouseOut="window.status='<?php echo $site;
    ?>';return true"><IMG SRC="../images/close.jpg" width=14 height=14
    border=0></A></TD></TR>
    <TR><TD><A class="t"
    HREF="javascript:menu.action='give.php';menu.submit();"><?php echo $oplossen
    ?></A></TD></TR>
    <TR><TD><A class="t"
    HREF="javascript:menu.action='point.php';menu.submit();"><?php echo $aldaar
    ?></A></TD></TR>
    </TABLE>
    </FORM>
    </SPAN>
    ?<php
    $tab="<A HREF=\"JavaScript:menu.Sid.value=$line[8];setMenu('options',1)\"
    onMouseOver=\"window.status='$menu_zien';return true\"
    onMouseOut=\"window.status='$site';return true\"><IMG
    SRC=\"../images/menu.gif\" border=0 alt=\"$altmenu\" width=50
    height=13></A>";
    .....
    .....
    .....
    ?>



    The setmenu-javascript puls mouse coordinates and places the menu on the
    item I select.
    The small php line, places the content-id, as pulled from a mysql_database,
    in the menu

    So basically, ther would be no other way.

    Page goes live in a few days.... I'll post the link.

    Thanks a zil,

    Michel







    "Steve Pugh" <> wrote in message
    news:...
    > "Michel" <> wrote:
    >
    > >Wuold it be possible to post a form using a textlink instad of an image

    or
    > >(ugly) button?

    >
    > Why not use CSS to make the button look less ugly? You could even make
    > it look like a text link.
    >
    > To submit a form with an <a> element would require JavaScript, which
    > won't be available to all your visitors.
    >
    > Steve
    >
    > --
    > "My theories appal you, my heresies outrage you,
    > I never answer letters and you don't like my tie." - The Doctor
    >
    > Steve Pugh <> <http://steve.pugh.net/>
    Michel, Oct 31, 2003
    #4
  5. "Michel" <> wrote:

    > Ey.... javascipt does cover 97,5% of my visitors (1800 daily) so I am
    > not really seriously worried)


    So you are willing to exclude about 50 visitors (according to your own
    guess) daily, just to make others confused? (Making a link submit _is_
    confusion.)

    > I wanted this, to be able to do both multiple actions on submit, as well
    > as changing the form action.


    As usual, the original question was not the real one, and naturally the
    question of multiple actions _is_ answered (correctly) in FAQs, so you have
    just wasted a few rounds of discussion to reach the wrong "solution".

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
    Jukka K. Korpela, Oct 31, 2003
    #5
  6. Michel

    Michel Guest

    No Sir,

    The tip I got was exactly what I needed.
    I post a HIDDEN form, using a textlink.
    And yes... excluding a few visitors is not a problem at all.
    Can't make everyone happy and covering IE4+ and NetScape4+ while 97,5% of my
    visitors is already on IE5.5 is a pretty good result.
    The page is service enough by itself.

    Ah... did I mention the free download of several browsers that understand
    JS?

    So, thanks for the tips, Again

    Michel




    "Jukka K. Korpela" <> wrote in message
    news:Xns9425DA1BE3EAFjkorpelacstutfi@193.229.0.31...
    > "Michel" <> wrote:
    >
    > > Ey.... javascipt does cover 97,5% of my visitors (1800 daily) so I am
    > > not really seriously worried)

    >
    > So you are willing to exclude about 50 visitors (according to your own
    > guess) daily, just to make others confused? (Making a link submit _is_
    > confusion.)
    >
    > > I wanted this, to be able to do both multiple actions on submit, as well
    > > as changing the form action.

    >
    > As usual, the original question was not the real one, and naturally the
    > question of multiple actions _is_ answered (correctly) in FAQs, so you

    have
    > just wasted a few rounds of discussion to reach the wrong "solution".
    >
    > --
    > Yucca, http://www.cs.tut.fi/~jkorpela/
    > Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
    >
    >
    Michel, Nov 1, 2003
    #6
  7. Michel wrote:

    http://www.allmyfaqs.com/faq.pl?How_to_post

    > I post a HIDDEN form, using a textlink.
    > And yes... excluding a few visitors is not a problem at all.


    I consider excluding any visitors a problem, at least if it can be easily
    avoided.

    > Ah... did I mention the free download of several browsers that understand
    > JS?


    Which does so much good in a corporate environment with a
    no-js-no-user-installed-software policy.

    --
    David Dorward http://dorward.me.uk/
    David Dorward, Nov 1, 2003
    #7
  8. "Michel" <> wrote:

    > So, thanks for the tips, Again


    Thank you for your eloquent request to be ignored in future. Please do not
    stop upside-down quoting or using forged From field before you have a clue
    and you wish to improve rather than deteriorate your pages. TIA.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
    Jukka K. Korpela, Nov 1, 2003
    #8
  9. Michel wrote:

    > The tip I got was exactly what I needed.
    > I post a HIDDEN form, using a textlink.


    Does the script at the other end of the form allow GET requests? If so,
    just use a link like this:

    <a href="http://example.org/handler.cgi?x=1&amp;y=2&amp;z=3">submit form
    with x=1, y=2 and z=3</a>

    No (client side) scripting required and will work in any browser that
    supports RFC1738[1].

    If the script only accepts POST and can't be changed, then use a normal
    submit button, but *then* use Javascript to *hide* the normal button and
    use document.write to create a a Hywel-style link. Like this:

    <body onload="document.getElementById('submitbutton').style.display='none';">
    <form action="someplace.cgi" method="POST" name="myform">
    <input type="hidden" name="x" value="1">
    <input type="hidden" name="y" value="2">
    <input type="hidden" name="z" value="3">
    <input type="submit" id="submitbutton">
    <script type="text/javascript"><!--
    document.write('<a href="#" onClick="myform.submit();"');
    document.write('>Send<');
    document.write('/a>');
    --></script>
    </form>
    </body>

    This way, browsers that don't do JavaScript won't get the JavaScript link,
    but will get a normal button instead. In browsers that understand
    Javascript, the button will be hidden, and they will get the link. So
    everyone's happy.

    [1] This is the document that formally defines URLs.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?id=132
    Toby A Inkster, Nov 1, 2003
    #9
  10. Michel

    Michel Guest

    Now this is a nice one. Thank you Toby!

    Michel

    "Toby A Inkster" <> wrote in message
    news:p...
    > Michel wrote:
    >
    > > The tip I got was exactly what I needed.
    > > I post a HIDDEN form, using a textlink.

    >
    > Does the script at the other end of the form allow GET requests? If so,
    > just use a link like this:
    >
    > <a href="http://example.org/handler.cgi?x=1&amp;y=2&amp;z=3">submit form
    > with x=1, y=2 and z=3</a>
    >
    > No (client side) scripting required and will work in any browser that
    > supports RFC1738[1].
    >
    > If the script only accepts POST and can't be changed, then use a normal
    > submit button, but *then* use Javascript to *hide* the normal button and
    > use document.write to create a a Hywel-style link. Like this:
    >
    > <body

    onload="document.getElementById('submitbutton').style.display='none';">
    > <form action="someplace.cgi" method="POST" name="myform">
    > <input type="hidden" name="x" value="1">
    > <input type="hidden" name="y" value="2">
    > <input type="hidden" name="z" value="3">
    > <input type="submit" id="submitbutton">
    > <script type="text/javascript"><!--
    > document.write('<a href="#" onClick="myform.submit();"');
    > document.write('>Send<');
    > document.write('/a>');
    > --></script>
    > </form>
    > </body>
    >
    > This way, browsers that don't do JavaScript won't get the JavaScript link,
    > but will get a normal button instead. In browsers that understand
    > Javascript, the button will be hidden, and they will get the link. So
    > everyone's happy.
    >
    > [1] This is the document that formally defines URLs.
    >
    > --
    > Toby A Inkster BSc (Hons) ARCS
    > Contact Me - http://www.goddamn.co.uk/tobyink/?id=132
    >
    Michel, Nov 3, 2003
    #10
  11. Michel

    Michel Guest

    Please ignore me at will, agressive boy...
    Michel, Nov 3, 2003
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Baker

    WebClient form Posting with form name?

    Jeff Baker, Aug 28, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    727
    John Saunders
    Aug 29, 2003
  2. alanb
    Replies:
    2
    Views:
    505
    alanb
    Apr 23, 2004
  3. Rob Meade
    Replies:
    0
    Views:
    411
    Rob Meade
    Dec 1, 2004
  4. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    782
    Kevin Spencer
    May 17, 2005
  5. AmitKu
    Replies:
    7
    Views:
    473
    John Timney \(MVP\)
    Jan 8, 2007
Loading...

Share This Page