Submit a form protected by JavaScript

Subscribe to Submit a form protected by JavaScript 3 posts, 2 voices

 
Avatar Mbolland 3 posts

bq.Hi guys,

Here is a tricky question for the best of you ;o)

the website I am trying to scrap here is kind of protected. Instead of having a button to send it, it has a link image that runs a javascript.

Getting the URL, filling the form, everything works perfectly, ... when I try to submit the form with some erroneous values in some field, it does submit it, and then return me the correct error messages. But when I fill it in with appropriate values and submit it, it just doesnt do anything. It loads on the same page and the registration doesnt work.

Do you have any suggestions ?

I tried to post the javascript here, but this forum would not let me. :o) it s displaying weird things

My first idea was to search for <body> and replace it with <body onload="javascript ... insert the code here">

But I m searching for a more elegant solution. Some work around … or something like “execute script blahbla…”

Thx for your reflection

Matt

 
Avatar Mbolland 3 posts

I found a good solution. What the javascript was doing is to take some string, modify it and assign it to two hidden input fields created at the beginning of the form. This way, the registration program knows it is not an automatic form submission, but a human that clicked the button. In this case, this is not true anymore. Just search for those input fields using hpricot and assign the final value (in this case easy to guess) returned by the javascript to them.

Cheers Matt

 
Avatar Antel 62 posts

Can you post here the script(obfuscated so they don’t know)? I was messing up with hpricot and scrubyt for extract a string.. days and weeks without results, a pain! ,,for Javascript: Firescrubyt isn’t a solution as scrubber want to be(:p) because it’s visual and cannot run in background, it’s slow too.. the solution is process the javascript with an external interpreter like elinks-links2 ones and parse automatically the output to scrubyt readable commands, like hidden javascript fields or javascript redirects(a pain).