javascript validation inside xform

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

javascript validation inside xform

safraz
Hi,

I'm a newbie to xform/obeon.

I have a xform which has no of fields including a textarea.
I can enter javascript codings to the textarea.
In prior saving i have to validate the entered javascript. (check for syntax errors, etc...)
If the validation fails, the error message should display in the form
How can i achieve this within xform? (or even calling servlet/jsp/javascript)

Your assistance highly appreciated.

Regards,
Safraz
Reply | Threaded
Open this post in threaded view
|

Re: javascript validation inside xform

Hank Ratzesberger
>

> Hi,
>
> I'm a newbie to xform/obeon.
>
> I have a xform which has no of fields including a textarea.
> I can enter javascript codings to the textarea.
> In prior saving i have to validate the entered javascript. (check for
> syntax
> errors, etc...)
> If the validation fails, the error message should display in the form
> How can i achieve this within xform? (or even calling
> servlet/jsp/javascript)
How would you validate your JavaScript?  Is there a
library in Java to do this?  Or, a
compiled program that does this?

If there is a java program, you could call it in an
xpl script without recompiling OF:

http://www.orbeon.com/ops/doc/processors-java

If it is a command line program, then you would
call it using the exec-processor which I don't
think the documentation is available.

But in either case, you could write a pipeline
that receives an XML document which has the
textarea text in one the elements.  You can
even call this xpl script within XForms using
call-xpl:

http://www.orbeon.com/ops/doc/reference-xforms-functions#orbeon-extensions

the xpl script would need to return an
xml document that has the results from
parsing / checking the JavaScript, such
as <errormsg>Expecting ")" on line 3</errormsg>

So basically, you use the <action> element
(for example within a <trigger>) to submit
the text/JavaScript to you xpl script that
checks it.

The dialog extension could be a good way
to display error messages:

http://www.orbeon.com/ops/doc/reference-xforms-extensions#dialog

Hopefully I'm steering you in the
right direction.

--Hank


>
> Your assistance highly appreciated.
>
> Regards,
> Safraz
>
> --
> View this message in context:
> http://www.nabble.com/javascript-validation-inside-xform-tp23830295p23830295.html
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: javascript validation inside xform

safraz
I guess, i got the right direction on right time.



--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws


Reply | Threaded
Open this post in threaded view
|

Re: javascript validation inside xform

safraz
can i pass a nodeset to <p:input> @href , instead of an xml file?

eg :

<p:input name="data" href="instance('constructor-instance')/constructor-arg"/>


what i want is to submit the nodeset to java processor and retrieve the processed data back to xform.







safraz wrote
I guess, i got the right direction on right time.



--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws

Reply | Threaded
Open this post in threaded view
|

Re: Re: javascript validation inside xform

Hank Ratzesberger

Safraz,




On Jun 4, 2009, at 5:22 AM, safraz wrote:

> can i pass a nodeset to <p:input> @href , instead of an xml file?

XPL scripts that are invoked from the page flow
controller cannot directly access model/instance
data of your xforms (even when they are specified
as the "model" attribute in the page element -- it
refers to MVC and not XForms).

However, you indirectly have access through the
special xpl parameter "instance" and with XPath
through "doc('input:instance')" .

http://www.orbeon.com/ops/doc/reference-page-flow#accessing-submission

Do you have an XPL file that follows this pattern?

http://www.orbeon.com/ops/doc/reference-page-flow#d24e2591

Then you can submit to it any valid XForms submission. So,
you have to submit an entire instance, but you could use
xslt or xpath within your xpl file to select only the
nodes you want you java processor to handle.

Hopefully....
Hank



>
> eg :
>
> <p:input name="data"
> href="instance('constructor-instance')/constructor-arg"/>
>
>
> what i want is to submit the nodeset to java processor and  
> retrieved the
> processed data back to xform.
>
>
>
>
>
>
>
>
> safraz wrote:
>>
>> I guess, i got the right direction on right time. :jumping:
>>
>>
>>
>> --
>> You receive this message as a subscriber of the [hidden email]  
>> mailing
>> list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>>
>
>
>
> --
> View this message in context: http://www.nabble.com/javascript- 
> validation-inside-xform-tp23830295p23868827.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws