forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Modification of Form Browser Application - original by skit

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 5 Source Code
View previous topic :: View next topic  
Author Message
cnodnarb
Valued Contributor
Valued Contributor


Joined: 11 Sep 2002
Posts: 686
Location: Evansville, IN

PostPosted: Sun Apr 10, 2011 5:58 am    Post subject: Modification of Form Browser Application - original by skit Reply with quote

Modification of original code by skit3000 to demonstrate vdsdom50.dsu

skit's original - http://forum.vdsworld.com/viewtopic.php?t=2674&postdays=0&postorder=asc&start=30&sid=e4be50d8c4d7d2478c90eca8ee4effd2

vdsdom.dsu - http://www.vdsworld.com/forum/viewtopic.php?t=5139

EDIT: DSC file MUST be saved for this to work properly. Not sure why.

Code:
external vdsbrw50.dll
#include vdsdom50.dsu
#define command,browser
rem #define function,ParseURL

  DIALOG CREATE,Register this software,-1,0,356,363
  rem Be sure to give the browser element the NONAVIGATE style.
  DIALOG ADD,BROWSER,BROWSER1,5,5,345,353,"",,NONAVIGATE
  DIALOG SHOW

rem Make sure the variable we are going to use to put the HTML code in, is empty.
%x =
rem You always have to add the "onContextMenu='return false;' text to the <body> tag, to
rem prevent users from viewing the source of your page.
%x = %x"<body background='http://cusveller.nl/afbeeldingen/Watermerk_02.jpg' onContextMenu='return false;'>"
rem Just like with normal HTML pages, you can just specify CSS styles to your document.
%x = %x" <style>input,select{font-family: Verdana; font-size: 10 px; color: red; border: 1 solid #000000;}</style>"
%x = %x" <style>table{font-family: Verdana; font-size: 10 px;}</style>"
%x = %x"  <form action='form:' method='get'>"
rem We will display the form fields in a table, so they are aligned real nice.
%x = %x"   <table width='100%'>"
%x = %x"    <tr> <td colspan='2'><b>Please fill out the form below to complete your registration.</b></td></tr>"
%x = %x"    <tr> <td>Name</td>    <td><input type='text' name='frmName'></td>     </tr>"
%x = %x"    <tr> <td>Address</td> <td><input type='text' name='frmAddress'></td>  </tr>"
%x = %x"    <tr> <td>ZIP</td>     <td><input type='text' name='frmZIP'></td>      </tr>"
%x = %x"    <tr> <td>City</td>    <td><input type='text' name='frmCity'></td>     </tr>"
%x = %x"    <tr> <td>Phone</td>   <td><input type='text' name='frmPhone'></td>    </tr>"
%x = %x"    <tr> <td>E-mail</td>  <td><input type='text' name='frmEmail'></td>    </tr>"
%x = %x"    <tr> <td>Payment</td> <td><select size='1' name='frmPayment'><option selected>with cash</option><option>by bank</option><option>by creditcard</option></select></td></tr>"
%x = %x"    <tr> <td>&nbsp;</td>  <td><input type='submit' value='Register'></td> </tr>"
%x = %x"   </table>"
%x = %x"  </form>"
%x = %x"</body>"

rem Now just load the contents of %x into the browser element.
dialog set,browser1,%x
rem cnodnarb - workaround. DOM access requires cookes, which require a saved or online document.
browser savefile,browser1,@path(%0)output.html
dialog set,browser1,@path(%0)output.html
 
:Evloop
wait event
goto @event()

:Browser1navigate
rem First, capture the URL and put it into a variable.
%%navURL = @browser(browser1,navURL)
rem Now use the @ParseURL() function to get the values of the
rem input fields.
%%frmName    = @getattribute(browser1,tag,input,value,0)
%%frmAddress = @getattribute(browser1,tag,input,value,1)
%%frmZIP     = @getattribute(browser1,tag,input,value,2)
%%frmCity    = @getattribute(browser1,tag,input,value,3)
%%frmPhone   = @getattribute(browser1,tag,input,value,4)
%%frmEmail   = @getattribute(browser1,tag,input,value,5)
%%frmPayment = @getattribute(browser1,tag,select,selectedIndex,0)
%%frmPayment = @getattribute(browser1,tag,option,innerHTML,%%frmPayment)

rem Now do something with these values. You can do things like putting it into a
rem INI file, do some calculations with it or display some results.
info Hello %%frmName from %%frmAddress"," %%frmZIP %%frmCity. Should I phone you at %%frmPhone or send you an E-mail at %%frmEmail? You are going to pay %%frmPayment.
goto Evloop

:Close
exit
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 5 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group