By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,686 Members | 1,558 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,686 IT Pros & Developers. It's quick & easy.

Submit a Form without a physical click.

100+
P: 196
Before you read below i only added that so you may understand my problem more fully, basically all i am trying to achieve is an onpage load sumbit form function.

Also i have previously tried this code with no success -

Expand|Select|Wrap|Line Numbers
  1. head>
  2. <script type="text/javascript">
  3. function formsubmit(){
  4. document.forms["myform"].submit();
  5. document.myform.submit();
  6. }
  7. </script>
  8. </head>
  9.  
  10. <BODY onLoad="formsubmit()">
  11. .
  12. .
  13. .
  14. .
  15. <input type="submit" value="Submit" name="submit" id="myform">
  16. </BODY>
  17.  
So im currently setting up a Aritcle Directory for someone else. They specifically requested that i use a piece of software called "ArticleDashboard".

Now i have successfully setup the Article Directory, BUT there are no articles in the Article Directory at all.

So I wrote some code mainly .php that can parse other Article Directorys (i.e. Not the one im working with) for Articles that can then be added to to the Directory that i am working with.

So i can successfully store this information in mysql database table, NOW the problem resides in actually storing this information into The Article Directorys database.

The first solution i tried to implement was intergrating my code with that of the Article Directorys code BUT i ran into the problem that all files/code are encrypted using ioncube which made that solution impossible to implement.

Then i tried to manually input the articles that i retrieved from other websites (Those within the ArticleDashboard Netork) directly into the Article Directorys mysql Database, what i found while reviewing the database tables for the directory im working on is that the articles are stored in some sort of binary file, that is linked to the mysql database, which also happens to be encrypted making that solution unviable.

Now the finally solution i determined which is frankly the most ad-hoc of the lot is to use the seperately stored articles i have, to dump the information into an article submission page which i modifyied to allow me to input the data automatically.

This is where what i am asking will now become obvious, so i can get each article into a submission page one at a time via simply reloading the page and it updates to the next article to submit, now the problem is at the moment i have to physically click the sumbit button so that the article will then be added to the Article Directory.

I am wondering if there is anyway around this, what i want not sure if possible though, is to have an automatic submit button so i can then use a cron job.
Jul 5 '10 #1
Share this Question
Share on Google+
3 Replies


RamananKalirajan
100+
P: 607
Hi,
document.forms["myform"].submit();

Can you please tell me why u have used like this. I know we will be submitting the form by specifying the form number over there. Like forms[0] or forms[1]. Can you please clarify me on this one. The best way to debug JS is having alert line by line. Try placing some alert and check whether ur code is executing as designed.

Thanks and Regards
Ramanan Kalirajan.
Jul 5 '10 #2

100+
P: 196
actually i have 2 similar commands to submit the form -
Expand|Select|Wrap|Line Numbers
  1. document.forms["myform"].submit();
  2.  
And

Expand|Select|Wrap|Line Numbers
  1. document.myform.submit();
  2.  
They are both supposed to do the same thing, where would you suggest that i place a alert box?
Jul 6 '10 #3

100+
P: 196
Figured it out turned out there was another javascript function interfering with the execuition of the script, also the script was somehow to complicated to submit. In the end i removed all excess code and simplified it right down so now it will sumbit the form automatically upon submission.

Now all i have to check is weither when you run the page as a cron job that the javascript will execute or not.
Jul 6 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.