Hello,
I attempted to integrate that into the JavaScript form filling code, it loaded the form web page but didn't auto-fill
Here's some example code:
Code:
javascript:(function(){ var error = 0; var keepError = 'I tried my best, but I was unable to fill in your form perfectly.<br><br>'; var formsArray = content.document.getElementsByTagName('form');try{ formsArray[0]['q'].value='MYSEARCH'; } catch(e){ error = 1; keepError = keepError + '- Form field q could not be found.<br>'; } try { formsArray[0].elements[4].checked=true; } catch(e){ error = 1; keepError = keepError + '- Form radio meta could not be found.<br>'; } if(error == 1){ var newwin = window.open('', 'formsaver', 'HEIGHT=250,WIDTH=600,resizable=1,scrollbars=1'); newwin.document.writeln(keepError); newwin.document.close(); newwin.focus(); } })()
That's a sample of MYSEARCH being autofilled on the Google homepage.
So, integrating it with the script above should go something like this?:
Code:
window.location = "http://www.website.com/form/";
checkLoad();
function checkLoad()
{
if (window.onLoad)
{
(function(){ var error = 0; var keepError = 'I tried my best, but I was unable to fill in your form perfectly.<br><br>'; var formsArray = content.document.getElementsByTagName('form');try{ formsArray[0]['q'].value='MYSEARCH'; } catch(e){ error = 1; keepError = keepError + '- Form field q could not be found.<br>'; } try { formsArray[0].elements[4].checked=true; } catch(e){ error = 1; keepError = keepError + '- Form radio meta could not be found.<br>'; } if(error == 1){ var newwin = window.open('', 'formsaver', 'HEIGHT=250,WIDTH=600,resizable=1,scrollbars=1'); newwin.document.writeln(keepError); newwin.document.close(); newwin.focus(); } })()
} else {
setTimeout('checkLoad();', 1000)
}
}