Hello.
I need to fill some web page fields with data that is already in a Windows 32 Delphi application.
The problem is that I don't know the name of the fields of the web page because it has
frames and the right mouse button (to see the source code) is disabled. If I use the browser's
menu: View/"Source code" I only get this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<TITLE>Logistics System 2.01</TITLE>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScri
pt">
<meta content="
http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<SCRIPT language="javascript">hist
ory.forwar
d();</SCRI
PT>
<SCRIPT language="javascript">self
.resizeTo(
1024,768);
</SCRIPT>
</HEAD>
<FRAMESET border="0" frameSpacing="0" rows="71,*" frameBorder="NO" cols="*">
<FRAME name="frmEncabezado" src="wfrEncabezado.aspx" frameBorder="no" noResize scrolling="no">
<FRAMESET frameSpacing="0" frameBorder="no" cols="184,786">
<FRAME name="frmMenu" src="wfrMenu.aspx" frameBorder="yes" bordercolor="#005fb3" scrolling="yes">
<FRAME name="frmTrabajo" src="wfrBlank.aspx" frameBorder="no" scrolling="yes">
</FRAMESET>
</FRAMESET>
</HTML>
In the Windows 32 application I have all the data that the users have to type manually to the web form, and I want to copy the data automatically when they push a button "copy data". The web application is from another company and I
have no access to the code.
Thanks in advance.
Here is the javascript that goes through all the elements and displays all of them in alert.
var
s : TStringList;
begin
s := TStringList.Create;
s.Add('javascript:function
s.Add('var ecnt=document.forms[0].ele
s.Add('var i;');
s.Add('var elist="";');
s.Add('for (i=0; i<ecnt; i++) {');
s.Add('el = document.forms[0].elements
s.Add('elist=elist+el.name
s.Add('}'); //end for
s.Add('alert(elist);'); //end for
s.Add('}; myselect();');
WebBrowser1.navigate(s.tex
s.Free;
end;
I hope this will help you. and once you know the field name setting its value is pretty simple.
See the following on how to set values through javascript.
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21867605.html