• 1 reply
  • Latest Post - ‏2011-04-26T06:13:31Z by SystemAdmin
1 Post

Pinned topic How pass the instance paramate into javascript function

‏2011-04-22T07:22:36Z |
I want to send the model paramaters into a javascript.
Is it the proper way of doing? or any other process ?

<script type="text/javascript">
<![CDATA[ <b> function ulrWindow(){
alert('I want to pass this
<xforms:output ref="Demo-form-data"/>'); close()</b>}]]> </script>
<title>Survey Form Register</title>
<p:input name="data" href="#instance"/>
<xforms:instance id="main">
<xi:include href="input:data"/>
<xforms:instance id="script">
<script url="javascript:close()"/>


Thank you , for submitting the Application
<xforms:group ref="friend" >
<xforms:output ref="Demo-form-data"/>
<xforms:load resource="javascript:ulrWindow()" ev:event="DOMActivate" />

Updated on 2011-04-26T06:13:31Z at 2011-04-26T06:13:31Z by SystemAdmin
  • SystemAdmin
    265 Posts

    Re: How pass the instance paramate into javascript function

    What you have there might work, depending on the XForms implementation you are using. However, it might be a dangerous thing to do, as it puts you at the mercy of cross site scripting attacks. (If someone manages to input the value of Demo-form-data somewhere else in the app, and show it through this page, if you don't escape it properly, they can inject anything the want in the web page.)

    So in general, I prefer to use an <xforms:output id="your-output" ref="what you want to access in JavaScript" style="display: none"/> and access the value of your-output in JavaScript with the DOM API.

    Orbeon Forms - Web 2.0 Forms, open source, for the Enterprise