javascript - onChange="document.myform.submit() and PHP while loop -
i have following code , on it's own works fine, need have in php while loop there may hundreds of records. not work, meaning not submit form.
any code, or other ideas work appreciated. needs write mysql db new value. please note less newbie javascript.
thanks
<form action="home.php" method="post" name="status"> <input type="hidden" name="record_number" value="<? echo $r['record_number']; ?>"> <input type="hidden" name="submit" value="cstatus"> <select name="statuscode" type="dropdown" style="font-size: 8pt; width: 60px" onchange="status.submit();"> <? if($r['statuscode']) { echo "<option value='".$r['statuscode']."'>".$r['statuscode']."</option>"; } ?> <option value='open'>open</option> <option value='closed'>closed</option> <option value='pending'>pending</option> <option value='cancelled'>cancelled</option> </select> </form>
onchange="status.submit();"
status undefined. sounds depending on legacy internet explorer weirdness create globals element name.
the quick fix is:
this.form.submit();
or, since there input named submit (avoid having things named same existing properties, makes mess)
document.createelement('form').submit.call(this.form);
that said, ui, drop down menu automatically submits form horrible, , depending on js poor approach.
having submit button each option (there maximum of 5) take little bit more space, resolve things single click.
<input type="submit" name="statuscode" value="open"> <input type="submit" name="statuscode" value="closed"> <input type="submit" name="statuscode" value="pending"> <input type="submit" name="statuscode" value="cancelled">
Comments
Post a Comment