Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
?_data=(EMail2787:'joe@gmail.com',Name:'Joe',Desc:'Please send details',Q:'20')
Note

While not manditory mandatory in all cases it is highly recommended that you enclose the values in single quotes. Thus Name:Joe should be added to the URL instead as Name:'Joe'. Also certain characters may need to be URL encoded. See quoting values below for details. Also note that the only supported format for dates is the XSD schema date format; you must use YYYY-MM-DD.

...

  • &_data=(A:!(one,two!)) expects to find two controls named B A (a repeat) and sets them to one and two.

...

Warning

You must specify the _formTz=<tz> parameter appended to the share URL when initializing a form with time or date/time controls from an XML init document, the _data parameter or a business rule that uses the rule identifier,form.load. This is because the form server needs to know the timezone in which to return the date and time. Successful initialization cannot be guaranteed if the &_formTz parameter is not supplied. This URL parameter is not needed if your form/flow only contais date contains date controls.

The local time will be converted to and saved in a valid UTC format for a time control and the time portion of the date/time control in the submission XML document.  You may see the time stored with a trailing "Z" or with an offset from UTC time. See Initializing Forms with XML Documents and Viewing XML Documents for further information.

...

One place this is very useful is in business rules. See the section on templatized URls in business rules for more details. However anywhere that you can use templates in your form: labels, help, hint; display message, etc... the value can either come from the value in an actual form field or from _data values that are not in any way bound to the name of a control.

_formActionUrl, _formActionMethod, _formActionTarget

The Form Action can be overridden by using these special (reserverd) URL parameter. The presence of _formActionUrl overrides any Form Action in the Form Designer by specifying which Url to go to when the form gets submitted.

_formActionMethod is optional and can be set to either "get" or "post". If unspecified it defaults to "get" causing the user to get forwarded to this web page when the form is submitted. If set to "post" it will also post the data to this Url.

_formActionTarget is optional and only taken into account when _formActionUrl is specified. It can be set to one of the values: frame, parent, top. It defaults to Frame if not specified.

When the _formActionUrl parameter is set but no Url is given (i.e. ...&_formActionUrl =&embed=...) the top frame will be closed. It is as if you set Form Action to Close" in the Form Designer.

For example... the Url http://www.frevvo.com/....&_formActionUrl=http://www.google.com, will cause the form to display google.com when it's submitted, even if in the Form Designer you had set the Form Action to be "Display Message" or one of the other options.

onInit/onSubmit

onInit and onSubmit are useful when you need to embed a  form in your own form and you want to programmatically submit the  form and initialize the form with your own document.

The value of onInit must be an in scope javascript function. This onInit javascript function will be called before the form is instantiated. For example &onInit=getData will cause  to call the getData() javascript function. The onSubmit function will be called after the submit button is clicked.

Here is a sample html page an embedded  script tag and an onInit javascript function. The  script tag copied was from the Share dialog and the &onInit Url parameter was appended. Each xml document is placed inside a container element (input, textarea or any other element such as a div) and assigned and xml id. In this example there is a single xml document placed inside a <textarea> tag.

...

onInit/onSubmit

The onInit feature allows you to populate your embedded frevvo form with the data from your own HTML form. So if you want to pass some data from your web page to the frevvo form embedded into that same web page, you will use onInit. onInit function will execute when the frevvo form loads.

The onSubmit function allows you to copy the data from the frevvo form (when that frevvo form is submitted) into your HTML form. Then you can use your own JavaScript on your HTML page to process that data (for example save it somewhere else at your own convenience and time, etc.)

The embedding page and must be in the the same domain/origin.Typically this means same uri scheme, host and port.

The value of onInit must be an in scope javascript function. This onInit javascript function will be called before the form is instantiated. For example &onInit=getData will cause  to call the getData() javascript function. The onSubmit function will be called after the submit button is clicked.

Here is a sample html page an embedded  script tag and an onInit javascript function. The  script tag copied was from the Share dialog and the &onInit Url parameter was appended. Each xml document is placed inside a container element (input, textarea or any other element such as a div) and assigned and xml id. In this example there is a single xml document placed inside a <textarea> tag.

Code Block
<!DOCTYPE html   
  PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
        <head>   
                <script language="JavaScript" type="text/javascript">    
                        /**     
                                Called before the form is rendered in the iframe     
                                Return - docs - [{       
                                                xml: *      
                                        }]    
                        **/    
                        function getData(){     
                                alert('onInit called');     
                                var textarea = document.getElementById('form');     
                                return [{      
                                        xml: textarea.value     
                                }];    
                        }   
                        /**     
                                Called after the form is submitted     
                                Parameters:      
                                        docs - [{       
                                                element:{        
                                                        name: *,        
                                                        namespace: *       
                                                        },       
                                                        xml: *      
                                        }]    
                        **/    
                        function onSubmit(docs){     
                                alert('onSubmit called');     
                                var textarea = document.getElementById('form');     
                                if( textarea )      
                                        textarea.value = docs[0].xml;    
                        }   
            </script>  
        </head>  
        <body>      
         <textarea id="form" name="doc1" rows="4" cols="100">   
             <ns:form xmlns:ns="http://www.frevvo.com/schemas/_07IOYMUdEeCuRePmBeMwTQ" name="Order">
<Item> <Color>Red</Color> </Item> <Item> <Color>Blue</Color> </Item> <Item> <Color>Red</Color> </Item> <Item> <Color>Green</Color>              <Item>
                    <Color>Red</Color> 
              </Item>
 </ns:form> </textarea> <script xmlns=http://www.w3.org/1999/xhtml src="http://localhost:8082/frevvo/web/tn/nancy.com/user/designer/app/_yVkhYcUdEeCuRePmBeMwTQ/ formtype/_07IOYMUdEeCuRePmBeMwTQ/embed?container=true&resize=true&onInit=getData" type="text/javascript" language="Javascript"></script> </body> </html>

...

  1. The Url parameter &onInit=getData used matches exactly the name of a javascript method in the html page also named getData(). 
  2. The xml data is also embedded in the html page in the <textarea> tag.
  3. The <ns:form> content came directly from a prior form submission and was copied out of the  submission repository's Documents tab.

Image Removed

This is how the form looks when initialized via the onInit method. The particular form used in this sample has a repeat control. By default this form has a single repeating item. When  initializes the form with repeating data returned from the getData() method it auto creates the additional items. This form also contained a Item Added Rule which is why there is also a value in the Quantity field.

...

              <Item> <Color>Blue</Color> 
              </Item> 
               <Item> <Color>Red</Color> 
              </Item> 
               <Item> <Color>Green</Color> 
              </Item> 
            </ns:form> 
        </textarea> 

       <script xmlns=http://www.w3.org/1999/xhtml 
        src="http://localhost:8082/frevvo/web/tn/nancy.com/user/designer/app/_yVkhYcUdEeCuRePmBeMwTQ/ formtype/_07IOYMUdEeCuRePmBeMwTQ/embed?container=true&resize=true&onInit=getData" type="text/javascript" language="Javascript">      
       </script> 
      </body> 
</html>


Things to note:

  1. The Url parameter &onInit=getData used matches exactly the name of a javascript method in the html page also named getData(). 
  2. The xml data is also embedded in the html page in the <textarea> tag.
  3. The <ns:form> content came directly from a prior form submission and was copied out of the  submission repository's Documents tab.

Image Added

This is how the form looks when initialized via the onInit method. The particular form used in this sample has a repeat control. By default this form has a single repeating item. When  initializes the form with repeating data returned from the getData() method it auto creates the additional items. This form also contained a Item Added Rule which is why there is also a value in the Quantity field.

Image Added

Post and XML Documents

If form A and form B both contain the same data source, and the Form Action in form A is set to '''Post''' to the form Url of form B, then form B's fields from schema will be initialized with the values entered into form 1.

This occurs because the Post request to the Form Server contains the XML document(s) from form A. If one data source was added from XSD schema to form A. Then it will contain two documents. The first is the form's from-scratch document containing elements for all controls added from palette. The second is the schema document.

Form B's from schema document is in the same namespace as form A's since we added the same XSD data source to both. So the values entered into form A's fields will be used as an initial instance document to initialize form B's fields.

See default field values to understand the precedence that XML documents sent in the Post request to form B take over the other possible methods of defaulting form field values.