Scripting Example 64

; *****************************************************

; Example64.ftp

; =============

; This example shows the new FORM functions.

; You can design your own interfaces in HTML and have

; that interface interact with your application

; written in the Perform Language.

; Examples 64 through 69 demonstrate the use of the

; various capabilities of FORMS and their interaction

; with your scripts.

;

; ---

;

; This demo simply accepts username and password from

; the user.

; Please view the source of the file called:

; pgUserLogin.html

; located in the HTMLS folder.

; You will see that the "Names" of the input fields in that

; source have the same name as the variables:

; varUsername

; varPassword

; in this scripts. This fact is the key to the interaction

; between your scripts and your HTML forms.

;

; NOTE: In your HTML source you may "link" to a subroutine

; in your script by creating a HyperLink with a "gosub:"

; prefix. F.ex. a hyperlink: gosub:MySubroutine will execute

; the subroutine called "MySubroutine" if it exists in

; you scripts. This example shows and example of this.

;

; -----------------------------------------------------------

; Commands demonstrated:

;

; OpenForm : Show a modal Form.

;

; HideVariable : Prevents variable content from

; displaying. Used to hide f.ex.

; Password variables.

;

; LetHidden : Same as LET but hides the actual

; value being assigned to the variable.

;

; Syntax:

; OpenForm "<HTML Filename>"

; HideVariable "VariableName"

; LetHidden <Variable>=<Value>

;

; -----------------------------------------------------------

; NOTE: You are be able to execute this example unchanged.

; ***********************************************************

 

ToggleWindowOff

 

HideVariable varPassword

 

Let varUsername="<Your name>"

LetHidden varPassword="<Your Password>"

Let varButtonSubmit=""

Let varButtonCancel=""

 

; -- Set the FORM properties like position and sizes

; Those variable control the size and location of

; your FORM. If you set the "FormLeft" variable

; to -1 the FORM will be maximized during execution.

Let FormLeft=0

Let FormTop=0

Let FormWidth=450

Let FormHeight=320

Let FormCentered=True

 

; -- While hoevering over hyperlinks, display the link on the bottom

; of the window

Let FormDisplayLinks=True

 

; -- Now open the Form

OpenForm "%%Ftpctrldir%%\Htmls\pgUserLogin.html"

if "%%varButtonSubmit%%x" = "Submitx" then

Gosub DisplayFields

else

Message "Cancelled"

endif

 

EndScript

 

:DisplayFields

Message "Username: %%varUsername%%//13//Password: %%varPassword%%"

Return