Forum Moderators: open

Message Too Old, No Replies

Dynamic input field doesnt post in IE.

I have a dynamic input field that doesnt send its value.

         

Bonusbana

4:27 pm on May 30, 2004 (gmt 0)

10+ Year Member



Hi

I have a select menu, and if the user chooses the alternative "annan", a new input fields shows up where the user can input a value.

This method works fine in safari, but in IE, the added input field doesnt submit to the server side script.

Here is what I have:

javascript:

function moreFields(what,more) {

c = what.options[what.selectedIndex].value;
r = document.getElementById(more);

if (c == "annan") r.innerHTML = ' -> <input name="place" class="input" maxlength="60" type="text" style="width:130px;" />';

}

html:

<select name="place_s" onchange="moreFields(this.form.place_s,'custom_scene',);" class="select" style="width: 150px;">
<option value="">test1</option>
<option value="annan">annan</option>
</select>
<span id="custom_scene"></span>

Now, when I print out the post values from here, using php print_r($_POST) there is no $_POST['place'] value! In safari, there is, but not in IE. Why doesnt the javascript work as it should?

Any reply would be greatly aprechiated.

Rambo Tribble

4:45 pm on May 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What does the "->" in your innerHTML assignment accomplish?

Bonusbana

11:53 pm on May 30, 2004 (gmt 0)

10+ Year Member



Nothing really, just a visual guide. Its in javascript, thats why its not html encoded.

An Idea: would it be better to use a hidden input field and then just change it to text when the user chooses "annan".? So instead of having a innerHTML, I just change the input type to "text", thus making it editable.

maybe maybe...

DrDoc

2:01 am on May 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've had no problems with IE doing exactly what you describe. Which IE version are you referring to?

Bonusbana

8:58 am on May 31, 2004 (gmt 0)

10+ Year Member



I am reffering to IE5/mac, both osx and classic. I will do some further testing later today.

Can anyone confirm this works in IE/win?

DrDoc

3:27 am on Jun 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, dynamic fields work in IE/Win (and all other browsers I have tested). I have even been able to get it to work in NN4 in the past :)