* Create test htm Text to m.Test noshow <html> <head> <title>New User Sign Up</title> <script language="JavaScript"> function myForm_Validator(theForm) { if (theForm.ID.value.length != 10) { alert("Please enter 10 digits in the \"Id\" field."); theForm.ID.focus(); return (false); } var checkOK = "0123456789-,"; var checkStr = theForm.ID.value; var allValid = true; var decPoints = 0; var allNum = ""; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } if (ch != ",") allNum += ch; } if (!allValid) { alert("Please enter only digit characters in the \"ID\" field."); theForm.ID.focus(); return (false); } document.location.href = 'nowhere.htm'; return (true); } </script> </head> <body BACKGROUND=background.jpg> <h1 align="Center"><font color="#000080">New User Sign Up</font></h1> <form method="POST" action="file://c:/myDummy.htm" onsubmit="return myForm_Validator(this);" name="myForm"> <table border="0" cellspacing="1"> <tr><td>ID</td><td><input type="text" name="ID" size="16" maxlength="16"></td></tr> <tr><td>First Name</td><td><input type="text" name="First" size="30" maxlength="15"></td></tr> <tr><td>Last Name</td><td><input type="text" name="Last" size="30" maxlength="20"></td></tr> <td>Gender?</td> <td> <select name="Selection1"> <option value="0">- Gender -</option> <option value="1">Female</option> <option value="2">Male</option> </select></td></tr> <tr> <td>Multi Selection</td> <td> <select multiple name="MulSelection"> <option value="0">- Sports you watch -</option> <option value="1">Basketball</option> <option value="2">Soccer</option> <option value="3">Football</option> <option value="4">Volleyball</option> <option value="5">Formula1</option> <option value="6">Nascar</option> </select></td></tr> </table> <p> <input type="submit" value="Submit" name="B1"> <input type="reset" value="Reset" name="B2"> </p> </form> <p></BODY> </HTML> EndText StrToFile(m.test,'testme.htm') oForm = Createobject('form1',Sys(5)+Curdir()+'testme.htm') oForm.Show() Read Events Define Class form1 As Form Top = 0 Left = 0 Height = 470 Width = 740 DoCreate = .T. Caption = "HTML sample" Name = "Form1" cHTML = "" FirstTime = .t. * This is IE control - you'd use webbrowser4 from gallery instead * just because it already has some checks, extra pem. ie: wouldn't need readystate part * for the sake of keeping code short here I directly use olecontrol itself Add Object htmlviewer As OleControl With ; Top = 12, ; Left = 12, ; Height = 396, ; Width = 708, ; Visible = .T., ; Name = "HTMLViewer", ; OleClass = 'Shell.Explorer' Procedure Init Lparameters tcHTML With Thisform.htmlviewer .Navigate2(m.tcHTML) Do While .ReadyState # 4 && Wait for ready state Enddo Endwith Endproc Procedure htmlviewer.NavigateError Lparameters pdisp, url, frame, statuscode, Cancel Cancel = .T. Endproc Procedure htmlviewer.BeforeNavigate2 Lparameters pdisp, url, flags, targetframename, postdata, headers, Cancel lcVals = "" If This.Object.Document.Forms.Length > 0 For Each oFrm In This.Object.Document.Forms lcVals = lcVals + oFrm.Name + Chr(13) If oFrm.elements.Length > 0 For Each oElem In oFrm.elements If oElem.Type = "select-multiple" lcList='' For ix=0 To oElem.Length-1 If oElem.Item(ix).Selected lcList = lcList + Iif(Empty(lcList),'',',')+oElem.Item(ix).Value Endif Endfor lcVals = lcVals + "Name :" + oElem.Name + "/Value:"+lcList + Chr(13) Else lcVals = lcVals + "Name :" + oElem.Name + "/Value:"+oElem.Value + Chr(13) Endif oElem = .Null. Endfor Endif oFrm = .Null. Endfor Endif Cancel = !thisform.FirstTime && prevents actual navigation thisform.FirstTime = .F. Messagebox(lcVals) Endproc Procedure htmlviewer.Refresh Nodefault Endproc Procedure QueryUnload Clear Events Endproc EnddefineCetin