"charlie M" schrieb:
That might work or might cause me problems....
What? <http://www.jibbering.com/faq/faq_notes/pots1.html>
but I would much rather have the question answered....
"how can I add a nonexistant field and value at submit() time??"
Your Question Mark key is borken. Try
<form action="..." ...>
...
<script type="text/javascript">
function addField(f, sName, sValue)
{
var t;
if (f && sName
&& typeof document != "undefined"
&& ((t = typeof document.createElement) == "function"
|| (t == "object" && document.createElement))
&& ((t = typeof f.appendChild) == "function"
|| (t == "object" && f.appendChild)))
{
var oField = document.createElement('input');
if (oField)
{
oField.type = "hidden";
oField.name = sName;
oField.value = sValue || "";
f.appendChild(oField);
}
}
}
</script>
<input type="submit" onclick="addField(this.form, 'foo', 'bar');"
...
</form>
Whether that works, i.e. if that added control value is submitted, in
a user agent is a different matter. Required are enabled support for
client-side JS and support of W3C DOM Level 2 HTML. Double-checking
the submitted value server-side is a must.
PointedEars