return to I Love My Journal
A Little Closer to Center...
Musings about Life, Linux, and Latter-day Saints.
Pages
About Me
Links


Tags
PERSONAL 518
SPIRITUAL 414
LDS 312
BOOK OF MORMON 237
SCRIPTURES 154
STUDIO-JOURNEY 128
RELIGION 112
LINUX 79
COMPUTERS 65
LIFE 60
GENERAL CONFERENCE 45
GENTOO 39
MISCELLANEOUS 37
MUSIC 37
PROGRAMMING 33
CARS 29
FAMILY 23
MICROSOFT 23
AUDIO 21
I LOVE MY JOURNAL 18
FUN 15
CHILDREN 12
CURRENT EVENTS 10
NATURE'S WAY 10
VIDEO 9
DRM 9
CONEXM 7
BABBLINGS 7
PROVO CITY CENTER TEMPLE 6
FRIENDS 6
HEROD THE FINK 5
COMPUTER HARDWARE 5
GAMES 5
DRUMS 4
HAND OF GOD 3
AUDIO HARDWARE 3
STUDIO 3
KDENLIVE 3
ADVERSITY 3
GENERAL INSANITY 3
THANKS4GIVING 2
CATS 2
CHURCH NOTES 1
FOREVERGREEN 1
POLITICS 1
POETRY 1
YOUTH CONFERENCE 1
GOSPEL 1
PARENTING 1
MY JOURNAL 1
EVERYDAY THOUGHTS 1


RSS Feed

RSS FeedSubscribe!
Thu - Apr 05, 2007 : 12:43 pm
no mood
   rated 0 times
>>next>>
<<previous<<
Javascript form submission gotcha
I spent about 2 hours today trying to debug something so stupid and simple as the following code.
<script>
function submit_me() {
document.form1test.submit();
}
</script>
<form name="form1test" method="post" action="newuser.php">
<input name="submit" type="button" value="save" onclick="submit_me()">
</form>

Doesn't that look like it should work? Heh... yeah... right... The stupid gotcha is the {name="submit"} on the button field. *that* makes it impossible to submit this form via JS. The correct code can be found below:

<script>
function submit_me() {
document.form1test.submit();
}
</script>
<form name="form1test" method="post" action="newuser.php">
<input type="button" value="save" onclick="submit_me()">
</form>

and that's that!