phpme1221 Posted July 22, 2011 Author Share Posted July 22, 2011 Hi aykay, doesn't it appear as 1 form in the code after the foreach but in the browser it contains possibily multiple forms, so how to i submit once? thanks Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted July 22, 2011 Share Posted July 22, 2011 you will need JavaScript, i posted a useful link in one of my previous posts Quote Link to comment Share on other sites More sharing options...
phpme1221 Posted July 22, 2011 Author Share Posted July 22, 2011 Thanks aykay for getting back to me, but the function knows the # of forms to submit? just dont kow enough fo js to do it. Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted July 22, 2011 Share Posted July 22, 2011 what that function does is, when called, submits the 3 forms that are specified in the function scope.. function submitForms() { this.document.form1.submit(); this.document.form2.submit(); this.document.form3.submit(); } you would replace, form1, form2, form3 with the names of your forms... so if you had a form like so.. <form name="test_form" action="#" > the function would be function submitForms() { document.test_form.submit(); // add as many as you want really } then you can make a button that will call the function to submit all of the forms.. <button onlclick="submitForms()">Submit</button> Quote Link to comment Share on other sites More sharing options...
phpme1221 Posted July 22, 2011 Author Share Posted July 22, 2011 Hi Aykay, Thanks again, again we dont know # of forms this will generate, a user can have 1 server to register or 10 server to register. Whats really confusing in the after th foreach; there is only 1 <form tag so there is only 1 name but if you run the function you mention in you last poist there are 3 different form names to consider but i have only 1, even though it appears as more depending on amount a servers onwned by the user passed in the url Quote Link to comment Share on other sites More sharing options...
phpme1221 Posted July 22, 2011 Author Share Posted July 22, 2011 so in the function something to increment the form name using count , like name=form1 name=form2 but how do you code that ? Quote Link to comment Share on other sites More sharing options...
phpme1221 Posted July 22, 2011 Author Share Posted July 22, 2011 i saw this, will something like this work? count=0 while(document.forms[count]){ document.forms[count].submit() count++ } Quote Link to comment Share on other sites More sharing options...
phpme1221 Posted July 26, 2011 Author Share Posted July 26, 2011 Aykay you around , yes im short of begging, thanks Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted July 26, 2011 Share Posted July 26, 2011 i saw this, will something like this work? count=0 while(document.forms[count]){ document.forms[count].submit() count++ } this code should cycle through your forms and submit each yes Quote Link to comment Share on other sites More sharing options...
phpme1221 Posted July 26, 2011 Author Share Posted July 26, 2011 Thanks aykay, what should be in the form, so that the js code can use to reference? keep in mind this is an unknown array of servers. thanks <form name = ? or value = ? <input type='submit' name='entdb' value='Register' > </form>"; should it be a type = submit or type = button ? Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted July 26, 2011 Share Posted July 26, 2011 this talks about it http://www.codetoad.com/forum/15_24387.asp Quote Link to comment Share on other sites More sharing options...
phpme1221 Posted July 26, 2011 Author Share Posted July 26, 2011 thanks aykay, should i follow example 2 #2: "function submitAllDocumentForms()" - Submit all forms in document ? Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted July 26, 2011 Share Posted July 26, 2011 if those forms are the only ones that you are planning on having on the page, then yes follow example #2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.