Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Beginning JavaScript
|
BOOK: Beginning JavaScript
This is the forum to discuss the Wrox book Beginning JavaScript by Paul Wilton; ISBN: 9780764544057
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 2nd, 2004, 10:51 PM
Registered User
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to automate a post where submit has a value

All,
  I am trying to automate logging into a website, doing some work and closing out. I have it all complete, with one snag. The website I am trying to access requires submit to be a named value. When I put a value on the "submit" name, it does not pass it. If I try to do a hidden input type and name it submit, I can not use the document.form('form1').submit() -- I get Object doesn't support this property of method. (see http://www.cfdev.com/support/kb/inde...single/id/1066 for another case).

Here is my code. If you remove the "name=submit", you don't get the Javascript error, but you also do not submit the value. If you try to say "<INPUT type=hidden name=submit value=Login>", you can't submit it and get the "Object" error above. Any suggestions?

<HTML>
<HEAD>
<script language=JavaScript>
function post()
{
    var fdata = '<FORM name=frm1 id=frm1 action=http://server/login.php method=post><INPUT TYPE=hidden NAME=username value=user1><INPUT TYPE=hidden NAME=password value=password1><INPUT type=submit name=submit value=Login></FORM>';
    var win2 = open('blank.htm', 'win2');
    win2.document.open();
    win2.document.write(fdata);
    win2.document.forms['frm1'].submit();
}
</script>
</HEAD>
<BODY>
<input type=button onclick="post()" value="DO POST"><BR>
<div id=result align="center"></div>
</BODY >
</HTML>





Similar Threads
Thread Thread Starter Forum Replies Last Post
automate the fields anukagni Access 3 February 12th, 2007 08:45 AM
How to submit the different data on single submit pushpa Classic ASP Databases 1 January 24th, 2007 07:10 PM
how to submit a form and post java script variable arabuafef ASP.NET 1.0 and 1.1 Basics 2 July 14th, 2006 09:28 PM
Automate Queries Ben Access VBA 3 January 29th, 2004 08:50 AM
How can we submit a form without a submit butto phpsharma BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 October 20th, 2003 08:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.