Using the ability to set form elements visibility, popup forms can be created on your Virtual Ticket forms.
With the release of Workgroups 2010, Virtual Ticket allows programmatically hiding or showing any form elements. Using this feature, pseudo popup forms can be created on your Virtual Ticket forms. The solution requires the layering of a hidden popup box on top of the visible form elements. Then with MetaScript, show or hide the popup elements as required.
- Start by going into the design view of your form.
It works best to build the draft copy of the popup off to the side of your form.
- Place a bubble graphic or a standard box element.
- Temporarily expand the form's width property to include this bubble graphic to allow viewing while testing.
- Now add data fields, buttons, lines, graphics and boxes on top of the bubble graphic.
- Set the Visibility property for all elements to Always Hidden.
- Each element must be named uniquely in the Id property.
In the Global MetaScript for this form, create an array of the names of all of the popup elements you just created. In the example script, Email_Elements is the array of element names. This array is then used to set the visibility of those elements. Follow examples in the attached script to create the script functions.
Three buttons are added to the form for this solution:
- btn_Create which runs the function Create_Email()
sets the popup style properties to visible (makes popup visible)
- btn_Cancel which runs the function Cancel_Email()
sets the popup style properties to hidden (hides the popup)
- btn_Send which runs function Send_Email()
calls PS.Email() function and sets the popup style properties to hidden
Complete the testing and tweaking of the popup design before moving it into its final position.
| 1 | //@version "2.1" |
| 2 | //@javascript "1.8" |
| 3 | |
| 4 | //@include "database:PS.js" |
| 5 | |
| 6 | |
| 7 | var Email_Elements = ['lbl_To', 'ln_To', 'df_To', 'bg_To','lbl_From', 'ln_From', 'df_From', 'bg_From', |
| 8 | 'lbl_Subject', 'ln_Subject', 'df_Subject', 'bg_Subject', 'lbl_Body', 'df_Body', 'bg_Body', |
| 9 | 'lbl_Title', 'co_Email', 'btn_Cancel', 'btn_Send']; |
| 10 | |
| 11 | function Create_Email() { |
| 12 | for (var i=0; i < Email_Elements.length; i++) { |
| 13 | Form.getControlById( Email_Elements[i] ).style.visibility = "visible"; |
| 14 | } |
| 15 | } |
| 16 | function Cancel_Email() { |
| 17 | for (var i=0; i < Email_Elements.length; i++) { |
| 18 | Form.getControlById( Email_Elements[i] ).style.visibility = "hidden"; |
| 19 | } |
| 20 | } |
| 21 | function Send_Email() { |
| 22 | for (var i=0; i < Email_Elements.length; i++) { |
| 23 | Form.getControlById( Email_Elements[i] ).style.visibility = "hidden"; |
| 24 | } |
| 25 | PS.Email(Field( 'vFrom' ), Field( 'Email' ), Field( 'vSubject' ), Field( 'vBody' )) |
| 26 | alert("Your email has been sent."); |
| 27 | } |