Versions Compared

Key

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

...

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>Blue<<Color>Green</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>>      
       </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.

...