HTML FORM / JS Please Help!

RewiredRewired Member
edited March 2005 in Internet & Media
Hello and howdy all. I'm in dire need of some Javascript/HTML Form help. Thank you in advance, really. Here's the problem:

I have a form as illustrated below.

[PHP]
<form action="http://webmail.XXX/src/redirect.php&quot; method=post>

<input name="login_username" value="" type="text">

<SELECT name="domain">
<OPTION SELECTED>mydomain.com
<OPTION>myotherdomain.com
</SELECT>

<input name="secretkey" type="password">

<input value="Login" type="submit">

</form>[/PHP]

I need XXX to equal the value of domain.

I tried

[PHP]<script type="text/javascript">
document.write("<form action=http://webmail.&quot; + domain.value + "/src/redirect.php method=post>")
</script>[/PHP]

...in place of the opening FORM TAG. This didn't work.

I've been playing around with it and I've resolved to the fact that it's beyond me. Please, please help. Thank you so much.

Comments

  • a2jfreaka2jfreak Houston, TX Member
    edited March 2005
    You might be able to change the action once a selection has been made.

    document.form.action = "blah blah blah";
    or
    document.form.action.value = "blah blah blah";

    It's possible neither will work, though.

    You might try a PHP solution.
    Have the action be $_SERVER and when you process the form, see which domain was chosen and do a re-direct.

    [php]
    Header('Location: http://webmail.'.$_POST.'/src/redirect.php');
    [/php]
  • RewiredRewired Member
    edited March 2005
    a2jfreak,

    Thx for your help. I was able to redefine the action with "form.action" (without the quotes). I stuck that code in a function that runs when the form is submitted.

    I got the form up and working.

    Problem is, I stuck it in a page with two frames and it stopped working properly. It's the darndest thing. Outside of the frames it works just fine.

    Inside the frames, I click SUBMIT and it just refreshes the page. If I click SUBMIT again, it works. Everytime I open the page, the form only submits after the second time.

    I stuck an alert() in the function and it's not even running the function that declares the action. The second time I click SUBMIT the form works just fine.

    Here is the URL: http://peachfungus.com/login2.html There are actually two sets of form tags and too submit buttons.

    Thx again for your help.
  • RewiredRewired Member
    edited March 2005
    I discovered this is only an issue in Firefox. The frames work fine in IE.
  • MiracleManSMiracleManS Chambersburg, PA Icrontian
    edited March 2005
    And does anyone know why? Because IE is not W3C complient! YAY! Should ask GeneralKeebler about his issue with CSS one tiem :p
Sign In or Register to comment.