Hello Sir,
Check the following site if it of any use to you.
http://www.swissdelphicent
with regards,
padmaja.
Main Topics
Browse All TopicsI am trying to submit a form using the WebBrowser component but cannot figre out how to do this. There are several fields I need to populate prior to submitting. Does anyone have any working examples I could look at?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hello Sir,
Check the following site if it of any use to you.
http://www.swissdelphicent
with regards,
padmaja.
Try something like this approach. I built this to be able to submit forms in IE based on the form fields.
I have yet to finish it but it is a start. You can modify to use TWebbrowser but it is not really needed.
function FormSubmit
( AFormAction: String
; AFormTitle: String
; AFields: Array of String
; AFieldValues: Array of String
) : Boolean;
var
ShellWindow: IShellWindows;
WB: IWebbrowser2;
spDisp: IDispatch;
IDoc1: IHTMLDocument2;
Form: IHTMLFormElement;
Document: Variant;
k, m: Integer;
ovElements: OleVariant;
i: Integer;
IEFieldsCounter: Integer;
btnElement: Integer;
begin
ShellWindow := CoShellWindows.Create;
// get the running instance of Internet Explorer
for k := 0 to ShellWindow.Count do
begin
spDisp := ShellWindow.Item(k);
if spDisp = nil then Continue;
// QueryInterface determines if an interface can be used with an object
spDisp.QueryInterface(iWeb
if WB <> nil then
begin
WB.Document.QueryInterface
btnElement := -1;
if iDoc1 <> nil then
begin
WB := ShellWindow.Item(k) as IWebbrowser2;
Document := WB.Document;
// if correct instance...
if Pos(AFormTitle, Document.Title) <> 0 then
begin
// count forms on document and iterate through its forms
IEFieldsCounter := 0;
for m := 0 to Document.forms.Length - 1 do
begin
Form := IDispatch(Document.Forms.I
if Pos(UpperCase(AFormAction)
begin
ovElements := Document.forms.Item(m).ele
// iterate through elements
for i := 0 to ovElements.Length -1 do
begin
try
// if input fields found, try to fill them out
if (UpperCase(ovElements.item
(UpperCase(ovElements.item
begin
btnElement := i;
end;
if not ( (UpperCase(ovElements.item
(UpperCase(ovElements.item
begin
if (LowerCase(ovElements.item
begin
ovElements.item(i).Value := AFieldValues[i];
inc(IEFieldsCounter);
end;
end
else
begin
if StrToInt(AFieldValues[i]) = 1 then
begin
ovElements.item(i).Checked
end
else
begin
ovElements.item(i).Checked
end;
inc(IEFieldsCounter);
end;
except
// failed...
end;
end; { for i...}
if btnElement > -1 then
begin
ovElements.item(btnElement
end
else
begin
Document.forms.Item(m).sub
end;
end;
end; { for m }
end; {if Pos(AFormTitle, ...}
end; { idoc <> nil }
end; { wb <> nil }
end; { for k }
end;
procedure TForm1.Button1Click(Sender
begin
FormSubmit('GetOptions.asp
'Options Page', {FormTitle}
['__VIEWSTATE', 'OptionsList', 'OptionsList', 'OptionsList'] {AFields},
['', '0', '0', '1'] {AFieldValues}
);
end;
Business Accounts
Answer for Membership
by: geobulPosted on 2006-04-14 at 14:20:52ID: 16457382
Hi,
Please, look at the html source of the page you want to submit and tell me whether
- there is a form with NAME attribute;
- all fields are of type TEXT, they are a part of the form, have NAME attribute and the names are different;
If yes to the above it's easy, otherwise it's also possible but much more complicated.
Regards, Geo