473,562 Members | 2,822 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

auto POST-ing login data via "javascript:doc ument.form.subm it()" link

Hello.

Can anybody solve this problem?

I am using a server-side language (PERL) to *try* to POST data to a
HTTPS login script that doesn't have a standard "submit" button. The
form appears to use javascript to submit the document via the browser's
DOM.

<form action='loginSc ript.cgi' method="post" name="loginForm ">
<input name="userid" />
<input name="password" />
<a href="javascrip t:document.logi nForm.submit()" >
<img src="someImage. gif" >
</a>
</form>

I have verified this by
1) disabling javascript in my a browser and replicating the error of
being unable to submit ... and ...
2) creating my own simple form (roughly the same as the above code)
on my own site to submit the data (to the site of interest) without
problem!

Any ideas on how to use a server side language (PERL preferably) to
submit via this javascript dependent form?

the only think I can think of is to have my server-side language (PERL)
to create and run a
temporary javascript enabled form/webpage and capture the results...
but this would be highly inelegant..

Thanks in advance,

Dave

Jan 3 '06 #1
4 16249
wrote on 03 jan 2006 in comp.lang.javas cript:
<a href="javascrip t:document.logi nForm.submit()" >
<img src="someImage. gif" >


Why not use:

<input type='image' src='someImage. gif'>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 3 '06 #2
ds******@gmail. com wrote:
<form action='loginSc ript.cgi' method="post" name="loginForm ">
<input name="userid" /> ^[1] <input name="password" /> ^[1] <a href="javascrip t:document.logi nForm.submit()" > `----.,---'`-------.,-------'`---.,--' ^
[2] [3] [4] [5] <img src="someImage. gif" > ^[6] </a>
</form>
[1] IE does not support XHTML, so there is no use in serving it to it.
If it was HTML, it was equivalent to <input ...>&gt; which is just
as bad.

And should not the password `input' element be of type="password" ?

[2] The pseudo-protocol `javascript:' does not belong into `href'
attribute values, at least not without a graceful-degrading alternative.
Here, users without enabled client-side script support will not be able
to submit the form. A simple

<input type="image" src="someImage. gif" alt="whatever">

would have sufficed for all UAs newer than Netscape 4.x (1998).

[3] Form/HTMLFormElement objects should be referred to using the `forms'
collection of HTMLDocument objects: document.forms['loginForm'].

[4] Methods should be feature-tested on run-time before they are called:
<URL:http://pointedears.de/scripts/test/whatami#inferen ce>

[5] The HTML 4.01 Specification recommends against whitespace
after the `a' element's start tag and before its end tag:
<URL:http://www.w3.org/TR/html4/struct/text.html#h-9.1>,
"In order to avoid problems with SGML line break rules and
inconsistencies among extant implementations [...]"

[6] The `alt' attribute is missing for this to be Valid HTML.
<URL:http://validator.w3.or g/>
[...]
Any ideas on how to use a server side language (PERL preferably) to
submit via this javascript dependent form?
Yes, ask in a Perl newsgroup (comp.lang.perl .*). This does not have
anything to do with J(ava)Script/ECMAScript because what is done there is
nothing but emulating an unnamed submit button; incompetently, if I may
add.
the only think I can think of is to have my server-side language (PERL)
to create and run a temporary javascript enabled form/webpage and capture
the results... but this would be highly inelegant..


Yes, it would, and users would wonder what would happen. However, just for
the sake of completeness, for my RFC Search bookmarklet I happen to use
something similar:

data:text/html;charset=IS O-8859-1
%3C!DOCTYPE%20h tml%20PUBLIC%20 %22-//W3C//DTD%20HTML%204. 01//EN%22%20%22http ://www.w3.org/TR/html4/strict.dtd%22%3 E%3Chtml%3E%3Ch ead%3E%3Ctitle% 3ERFC%20Search% 3C/title%3E%3C/head%3E%3Cbody% 3E%3Cform%20act ion=%22http://www.rfc-editor.org/cgi-bin/rfcsearch.pl%22 %20method=%22po st%22%3E%3Cinpu t%20type=%22hid den%22%20name=% 22searchwords%2 2%20value=%22%s %22%3E%3Cinput% 20type=%22hidde n%22%20name=%22 filefmt%22%20va lue=%22txt%22%3 E%3Cinput%20typ e=%22hidden%22% 20name=%22num%2 2%20value=%2225 %22%3E%3C/form%3E%3Cscrip t%20type=%22tex t/javascript%22%3 Efunction%20isM ethodType(s)%20 %7B%20return%2
(s%20==%20%22fu nction%22%20%7C %7C%20s%20==%20 %22object%22)
%20%7D%20var%20 o%20=%20documen t;%20if%20(o%20 &&%20(o%20=%20o .forms)%20&&%2
(o%20=%20o%5B0% 5D)%20&&%20isMe thodType(typeof %20o.submit))%2 0o.submit()
%3C/script%3E%3C/body%3E%3C/html%3E

(This is initiated from the client side, of course.)
PointedEars
Jan 3 '06 #3
On 2006-01-03, ds******@gmail. com <ds******@gmail .com> wrote:
Hello.

Can anybody solve this problem?

I am using a server-side language (PERL) to *try* to POST data to a
HTTPS login script that doesn't have a standard "submit" button. The
form appears to use javascript to submit the document via the browser's
DOM.

<form action='loginSc ript.cgi' method="post" name="loginForm ">
<input name="userid" />
<input name="password" />
<a href="javascrip t:document.logi nForm.submit()" >
<img src="someImage. gif" >
</a>
</form>

Any ideas on how to use a server side language (PERL preferably) to
submit via this javascript dependent form?


AFAICT replacing the javascript link with

<input type="submit" value="login" >

produces the exact same request, so there's nothing magical about that form.
Is there a libcurl binding for PERL? (I mainly use PHP)

Bye.
Jasen
Jan 4 '06 #4

Lee wrote:
ds******@gmail. com said:

Hello.

Can anybody solve this problem?

I am using a server-side language (PERL) to *try* to POST data to a
HTTPS login script that doesn't have a standard "submit" button. The
form appears to use javascript to submit the document via the browser's
DOM.


figured it out.. false alarm... it was a lack of cookie handling
afterwards that kept me from getting in... thanks anyway.

Jan 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6143
by: Miles Davenport | last post by:
My Javascript is rather rusty :( ... and I need to do change some form values, in the folowing way: (1). I have the following a href (wrapped in PHP), which calls processForm. ==== <input type="hidden" name="myHiddenValue"> href="javascript:void(0)" onClick="processForm(\'' . $form_name
1
1555
by: Nathan DeBardeleben | last post by:
This may seem wierd, and I know someone asked this question before but was told they were doing it the hard way. Unlike them, I do not have shell access to the machine where this javascript runs. I need to run the 'submit' method on a Javascript on a page - but I need to do it without a browser. I can handle all the socket code, that's...
5
18769
by: RobG | last post by:
I am trying to get users to fill in a form on a web page, then click a button to send an e-mail. I am using JavaScript to get the fields from the form, then run a mailto command to put the information into an email. I can create a mailto link in the page using innerHTML, but it seems silly to click a button, a link appears, then click on...
3
1348
by: lawrence | last post by:
I've a big form with lots of options, and to keep things simple most of the options are hidden in an invisible DIV. The basic options are visible from the start. If people want the advanced options, they click the "More Options?" link. You can see below a bit I'm using in the middle of my forms to start the hidden DIV. The Javascript you see...
4
2675
by: Ike | last post by:
Oh I must be missing somethign so simple and stupid. I need to do a submit() via an href, which I do (succesfully) in JavaScript in many other pages with <a href="javascript:document.MyForm.submit();" For whatever reason, I cannot get the following page to submit -- I have been looking at this so long I cannot see it - though I know it;s...
2
1926
by: Cardinal | last post by:
In the application I'm developing, I need a link to behave as a form submit. I set up a little test example below and it worked fine: <table> <tr> <form action="action1.cfm" method="POST" enablecab="No" name="CareerActionPlanLink"> <td align="center"> <input type="Hidden" name="careerActionPlanID" value="7"> <a...
8
1321
by: ryan | last post by:
that will make sure all fields are entered. make sure age is between 3- 99 and make sure the email is valid I had a decent search on google, nothing really comes up that is complete. I am sure that it is out there somewhere?
26
2891
by: Mica Cooper | last post by:
Hi, I need to pass some info in a javascript submit. <a href="javascript:document.formName.submit();">Submit Form</a> Normally a link would do page.jsp?x1=1&x2=2&x3=3 and you would pull x1, x2, x3. I have no clue how to do this with a link submit. Thanks,
3
4121
by: Greg Scharlemann | last post by:
I have the following test page: <html> <head> <script type="text/javascript"> function submitForm() { alert("here"); return false; } </script>
13
323
by: Mtek | last post by:
Hi, We have a form defined with buttons like this: <a class="save_menu" href="javascript:document.Detail_Screen.action = 'savedata.php?screen=EDIT';document.Detail_Screen.submit();">Update</ a> The form also has an onSubmit action to vall a validation routine:
0
7577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7627
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7935
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6221
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5477
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5193
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3623
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
903
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.