Form Woes

Discussion in 'HTML' started by Leon, Feb 13, 2007.

  1. Leon

    Leon Guest

    Hi Chaps,

    I have been looking around the internet and I really can't see what I'm
    doing wrong here !

    This code works in firefox, but not internet explorer.

    Any suggestions please? Internet Explorer just doesnt update the action
    of the form so when you hit the button - it seemingly just refrehes the
    page!

    <form name="actions" action="" method="post">
    <select name="action" class="formBox">
    <option value="null" onclick="this.form.action.value='';">Select Action
    From List
    <option value="resendActEmail"
    onclick="this.form.action.value='./admin_process.php?a=resend';">Re-Send
    Activation Email
    <option value="deletaccount"
    onclick="this.form.action.value='./admin_process.php?a=delete';">Delete
    This Account
    </select>
    <input class="formBox" type="submit" name="submit" value="Go">
    </form>

    Thanks,

    Leon
     
    Leon, Feb 13, 2007
    #1
    1. Advertising

  2. Leon wrote:
    > Hi Chaps,
    >
    > I have been looking around the internet and I really can't see what I'm
    > doing wrong here !
    >
    > This code works in firefox, but not internet explorer.
    >
    > Any suggestions please? Internet Explorer just doesnt update the action
    > of the form so when you hit the button - it seemingly just refrehes the
    > page!
    >
    > <form name="actions" action="" method="post">
    > <select name="action" class="formBox">
    > <option value="null" onclick="this.form.action.value='';">Select Action
    > From List
    > <option value="resendActEmail"
    > onclick="this.form.action.value='./admin_process.php?a=resend';">Re-Send
    > Activation Email
    > <option value="deletaccount"
    > onclick="this.form.action.value='./admin_process.php?a=delete';">Delete
    > This Account
    > </select>
    > <input class="formBox" type="submit" name="submit" value="Go">
    > </form>


    No, no do not set the action with JavaScript. Looks like your want an
    either or option use a radio button and set the form destination in the
    ACTION attribute:

    <form action="./admin_process.php" method="post">

    ....

    <fieldset>
    <legend>Account Action</legend>
    <input type="hidden" name="b" value="zoom">
    <input name="a" id="resendIt" type="radio" value="resend" checked>
    <label for="resendIt">Re-Send Activation</label>
    <input name="a" id="deleteIt" type="radio" value="delete">
    <label for="deleteIt">Delete This Account</label>
    <input type="submit" value="Go">
    </fieldset>
    </form>


    Since your want POST method, not sure why you were hacking the ACTION to
    add a GET query string. Now in "admin_process.php":

    if(isset($_POST['a'])){
    if($_POST['a']) == 'resend'){
    //account resent routine
    }
    elseif($_POST['a']) == 'delete'){
    //account delete routine
    }
    else {
    // shouldn't happen your form's been hacked!
    }
    }

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Feb 13, 2007
    #2
    1. Advertising

  3. Leon wrote:
    > Hi Chaps,
    >
    > I have been looking around the internet and I really can't see what I'm
    > doing wrong here !
    >
    > This code works in firefox, but not internet explorer.
    >
    > Any suggestions please? Internet Explorer just doesnt update the action
    > of the form so when you hit the button - it seemingly just refrehes the
    > page!
    >
    > <form name="actions" action="" method="post">
    > <select name="action" class="formBox">
    > <option value="null" onclick="this.form.action.value='';">Select Action
    > From List
    > <option value="resendActEmail"
    > onclick="this.form.action.value='./admin_process.php?a=resend';">Re-Send
    > Activation Email
    > <option value="deletaccount"
    > onclick="this.form.action.value='./admin_process.php?a=delete';">Delete
    > This Account
    > </select>
    > <input class="formBox" type="submit" name="submit" value="Go">
    > </form>


    Wouldn't it be easier and clearer for your users if you skipped the form
    and just had a link for each action?
     
    Harlan Messinger, Feb 14, 2007
    #3
  4. Leon wrote:

    > Hi Chaps,
    >
    > I have been looking around the internet and I really can't see what
    > I'm doing wrong here !
    >
    > This code works in firefox, but not internet explorer.
    >
    > Any suggestions please? Internet Explorer just doesnt update the
    > action of the form so when you hit the button - it seemingly just
    > refrehes the page!
    >
    > <form name="actions" action="" method="post">
    > <select name="action" class="formBox">
    > <option value="null" onclick="this.form.action.value='';">Select
    > Action From List <option value="resendActEmail"
    > onclick="this.form.action.value='./admin_process.php?a=resend';">Re-Se
    > nd Activation Email <option value="deletaccount"
    > onclick="this.form.action.value='./admin_process.php?a=delete';">Delet
    > e This Account </select> <input class="formBox" type="submit"
    > name="submit" value="Go"> </form>


    Why would you do it this way when you can simply do it like this:

    <form action="./admin_process.php" method="post">
    <select name="a" class="formBox">
    <option value="">Select Action From List
    <option value="resend">Re-Send Activation Email
    <option value="delete">Delete This Account
    </select>
    <input class="formBox" type="submit" name="submit" value="Go">
    </form>

    --
    Kim André Akerø
    -
    (remove NOSPAM to contact me directly)
     
    =?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=, Feb 14, 2007
    #4
  5. Leon

    Rik Guest

    On Wed, 14 Feb 2007 19:56:23 +0100, Kim André Akerø
    <> wrote:

    > Leon wrote:
    >
    >> Hi Chaps,
    >>
    >> I have been looking around the internet and I really can't see what
    >> I'm doing wrong here !
    >>
    >> This code works in firefox, but not internet explorer.
    >>
    >> Any suggestions please? Internet Explorer just doesnt update the
    >> action of the form so when you hit the button - it seemingly just
    >> refrehes the page!
    >>
    >> <form name="actions" action="" method="post">
    >> <select name="action" class="formBox">
    >> <option value="null" onclick="this.form.action.value='';">Select
    >> Action From List <option value="resendActEmail"
    >> onclick="this.form.action.value='./admin_process.php?a=resend';">Re-Se
    >> nd Activation Email <option value="deletaccount"
    >> onclick="this.form.action.value='./admin_process.php?a=delete';">Delet
    >> e This Account </select> <input class="formBox" type="submit"
    >> name="submit" value="Go"> </form>

    >
    > Why would you do it this way when you can simply do it like this:
    >
    > <form action="./admin_process.php" method="post">


    Euhm, GET?

    > <select name="a" class="formBox">
    > <option value="">Select Action From List
    > <option value="resend">Re-Send Activation Email
    > <option value="delete">Delete This Account
    > </select>
    > <input class="formBox" type="submit" name="submit" value="Go">
    > </form>


    A whole lot simpler indeed. I'd prefer buttons though:
    <form action="./admin_process.php" method="get">
    <input type="submit" name="a" value="resend">
    <input type="submit" name="a" value="delete">
    </form>

    Allthough it's a pity the text on the button and the actual value cannot
    differ, but that's either pretty quickly solved server-side.
    --
    Rik Wasmus
     
    Rik, Feb 14, 2007
    #5
    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. Kevin Vaughn

    Date Woes

    Kevin Vaughn, Jul 3, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    627
    David Waz
    Jul 3, 2003
  2. Stephajn Craig

    Regular Expression Woes

    Stephajn Craig, Jul 17, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    410
    Chris R. Timmons
    Jul 18, 2003
  3. Li Zhang
    Replies:
    4
    Views:
    6,141
    softip
    Feb 27, 2009
  4. descds
    Replies:
    3
    Views:
    316
    descds
    Sep 16, 2004
  5. rob c
    Replies:
    4
    Views:
    365
    McKirahan
    Dec 30, 2005
Loading...

Share This Page