SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Feb 9, 2002, 23:45 #1
- Join Date
- Jul 2001
- Location
- Houston
- Posts
- 130
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Having Problem with submit() Method
I'm having problems with the submit() method of the forms object. I've got a form that submits fine if I use <input type="submit">; it executes an ASP page and redirects back to the same page. Because of the layout of my page, I don't want to put the button in that location, though. Instead, I've tried this:
Code:function submit_form(formIndex) { document.forms[formIndex].submit(); return true; }
Code:<form name="submit_button" onsubmit="return submit_form(0)"> <input type="submit" class="fielder3" value="preview"> </form>
-
Feb 12, 2002, 20:51 #2
- Join Date
- Oct 2001
- Location
- Whistler BC originally from Guelph Ontario
- Posts
- 2,175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:<form name="submit_button" onsubmit="return submit_form(0)"> <input type="submit" class="fielder3" value="preview"> </form>
<input type="button" class="fielder3" value="preview" onclick="return submit_form(0)">
With this one remove the onsubmit you have above.
OR
leave the button the same but remove the javascript submit. Is this all of your code because that just seems to be a redundancy.
Otherwise I am not sure why it is doing what it is doing but you are esentially submitting the form twice with your current codeMaelstrom Personal - Apparition Visions
Development - PhP || Mysql || Zend || Devshed
Unix - FreeBSD || FreeBsdForums || Man Pages
They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.
-
Feb 13, 2002, 10:27 #3
- Join Date
- Jul 2001
- Location
- Houston
- Posts
- 130
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Maelstrom-
Thanks for your help. I found a work-around that did the trick, but it's basically the same thing that you suggested. I have one form with lots of hidden elements that I submit from another location; that's why the code looked weird. I solved the problem by using the <input type="button"> tip just as you suggested.
Bookmarks