submit data on html form by delphi

WhiteSeed
WhiteSeed used Ask the Experts™
on
Hello everyone, I have a html page with a form. I need to verify the existence of a radio button to the form, if it exists activate it and click on submit.
 Is the form that the radiobuttons have an id (id = "formid", id = "radio1"). Sometimes the radio button is not visible. What I want to do is to check if it exists and if necessary activate it and click the submit button. But the button does not have an id, and looks like this:
 <a href="#" onclick="document.forms[0].status.value='reserve';document.forms[0].submit();return false;" class="btn_h32"> <b> Submit </ b> </ a>
 how can I do?

Sry for my english
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
if you using TWebBrowser try this code

// If there is only one button, you can do something like:    
    
WebBrowser1.OleObject.Document.forms.item(0).elements.item(0).click;    
    
// This will do a click on the first element of the first <FORM>, where an    
// element is either <INPUT>, <SELECT> or <TEXTAREA>.    
    
    
// If there is more than one button, you can do something like:    
    
procedure TForm1.Button1Click(Sender: TObject);    
var     
  ovElements: OleVariant;     
  i: Integer;     
begin     
  ovElements := WebBrowser1.OleObject.Document.forms.item(0).elements;     
  for i := 0 to (ovElements.Length - 1) do    
    if (ovElements.item(i).tagName = 'INPUT') and    
      (ovElements.item(i).type = 'SUBMIT') and    
      (ovElements.item(i).Value = 'Recent Charges') then    
      ovElements.item(i).Click;     
end;   

Open in new window


Code is not my i take it from http://www.swissdelphicenter.ch

Author

Commented:
this system don't run well, and i need to press the button for submit the form
Eddie ShipmanAll-around developer
Commented:
Use the same code as above but get the form and use the form's submit function instead of trying to click the submit button.

Author

Commented:
I found a "compromise" even if it is not by good programmer it work

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial