Autofill Webforms

I need to create a program that can load any url with a webform where name, address, tel ect must be entered. And then populate/autofill the individual form boxes with my specified data by the push of a button. Can anyone point me in the right direction? Thanks

Are you loading the URL within a HTMLViewer or in a browser?

If you’re within a HTMLViewer you can JavaScript inject form values, but you would have to know the field names. So it would be a multi-step process. Download the HTML with a HTTPSocket, parse it for form/field names, load it in HTMLViewer, JavaScript inject.

I’m using the HTMLviewer.

I found this to work with: jsSrc = "document.forms[0].elements['search'].value=""xojo"";" What does the [0] mean? I guess the .elements[‘search’] is the form fieldname?

http://www.w3schools.com/js/js_arrays.asp

Thanks Tim and Michael I got it to work perfectly.

Just one last question: How do I place a string variable in place of Comment?

jsSrc = "document.forms[0].elements['comment'].value=""Comment"";"

Ex:
Dim a as string
A= textfield.text
I have a problem with the the A string…

jsSrc = "document.forms[0].elements['comment'].value=(A);"

Do you know how to join multiple strings together in Xojo?
You would need to join the JavaScript inject with the string from the textfield to create your new inject.

Hi Tim, Yes. I know how to do it Xojo, but I can’t seem to get Xojo variable A to work in place of “Comment”
jsSrc = “document.forms[0].elements[‘comment’].value=”“Comment”";"

jsSrc = “document.forms[0].elements[‘comment’].value=???;”

OK, I got it this way:
You have to escape with single quote, double quotes + string variable + double quotes, single quote ;"
jsSrc = “document.forms[0].elements[‘comment’].value=’”+x+"’;"