HTML>
' Demo of MGCEHtml control, 1999 by Mark Gamber
' NS Basic is (c) NS Basic Corporation
' MGCEHtml is (c) Mark Gamber
' This program demos the MGCEHtml control. A tabstrip is created and used to control which
' form is displayed in an HTML control. The HTML control is given a form based on the tab and
' triggers an event when the form's Submit button is pressed. That event determines what form
' was used and generates output HTML using the "form color" and displaying the form name
' and data passed from the form as a list of fields.
AddObject "CETabStrip.TabStrip.1", "Tab", 2, 0, OUTPUT.Width - 4, 20
Tab.tabs.Add 1,, "Main Form"
Tab.tabs.Add 2,, "Second Form"
Tab.tabs.Add 3,, "Third Form"
Tab.tabs.Add 4,, "Misc"
Tab.tabs.Remove 5
AddObject "MGCENet.HTML", "HTML", 2, 22, OUTPUT.Width - 4, OUTPUT.Height - 24
AddForm( 1 )
Sub Tab_Click
s = Tab.SelectedItem.Caption
if s = "Main Form" then AddForm( 1 )
if s = "Second Form" then AddForm( 2 )
if s = "Third Form" then AddForm( 3 )
if s = "Misc" then AddForm( 4 )
end sub
sub AddForm( iForm )
if iForm = 1 then
s = "<body bgcolor='#C0C0C0'><center><br><form action='Form 1' method=POST>"
s = s & "<table border=1 bgcolor='#80FF80'>"
s = s & "<tr><td>Name:</td><input type='text' name='Name' size=30></td></tr>"
s = s & "<tr><td>Address:</td><input type='text' name='Addr' size=30></td></tr>"
s = s & "<tr><td>City:</td><td><input type='input' size=24 name='City'></td></tr>"
s = s & "<tr><td colspan=2 align='center'><input type='submit'></td></tr>"
s = s & "</table></form></center></body>"
end if
if iForm = 2 then
s = "<body bgcolor='#C0C0C0'><center><br><form action='Form 2' method=POST>"
s = s & "<table border=1 bgcolor='#FFFF80'>"
s = s & "<tr><td>This is a :</td><input type='radio' name='HPC' value='Casio'> Casio</td></tr>"
s = s & "<tr><td> </td><input type='radio' name='HPC' value='HP'>Hewlett-Packard</td></tr>"
s = s & "<tr><td> </td><input type='radio' name='HPC' value='Phillips'>Phillips</td></tr>"
s = s & "<tr><td> </td><input type='radio' name='HPC' value='Other'>Other</td></tr>"
s = s & "<tr><td colspan=2 align='center'><input type='submit'></td></tr>"
s = s & "</table></form></center></body>"
end if
if iForm = 3 then
s = "<body bgcolor='#C0C0C0'><center><br><form action='Form 3' method=POST>"
s = s & "<input type='hidden' Name='SlyField' value='ThirdForm'>"
s = s & "<table border=1 bgcolor='#FF80FF'>"
s = s & "<tr><td>Name:</td><input type='text' name='Name' size=30></td></tr>"
s = s & "<tr><td>Address:</td><input type='text' name='Addr' size=30></td></tr>"
s = s & "<tr><td>City:</td><td><input type='input' size=24 name='City'></td></tr>"
s = s & "<tr><td colspan=2 align='center'><input type='submit'></td></tr>"
s = s & "</table></form></center></body>"
end if
if iForm = 4 then
s = "<body bgcolor='#C0C0C0'><center><br><form action='Form 4' method=POST>"
s = s & "<table border=1 bgcolor='#FFFFFF'>"
s = s & "<tr><td>Name:</td><input type='text' name='Name' size=30></td></tr>"
s = s & "<tr><td>Address:</td><input type='text' name='Addr' size=30></td></tr>"
s = s & "<tr><td>City:</td><td><input type='input' size=24 name='City'></td></tr>"
s = s & "<tr><td colspan=2 align='center'><input type='submit'></td></tr>"
s = s & "</table></form></center></body>"
end if
HTML.Clear
HTML.AddText s
end sub
sub HTML_Click( sTarget, sData )
if sTarget = "Form 1" then s = "<body bgcolor='#80FF80'>"
if sTarget = "Form 2" then s = "<body bgcolor='#FFFF80'>"
if sTarget = "Form 3" then s = "<body bgcolor='#FF80FF'>"
if sTarget = "Form 4" then s = "<body bgcolor='#FFFFFF'>"
s = s & "<font size=4><b><br>" & sTarget
s = s & " submitted the following data:<br> <br> "
sData = Replace( sData, "&", "<br> " )
s = s & sData & "</body>"
HTML.Clear
HTML.AddText s
end sub