validation problem with upload button in ops xforms 3.5.1

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

validation problem with upload button in ops xforms 3.5.1

Laxmi Narayana-3
Hi,
I am using ops 3.5.1.
 
I try to put validation on upload button but it is not working. code is like this.
 In model  i provided like this:
<file filename="" mediatype="" size=""/>
validation :
<xforms:bind nodeset="//file" constraint=". != ''"/>
 
control::
  <xforms:upload ref="instance('main-instance')/file">
                <xforms:filename ref="@filename"></xforms:filename>
               <xforms:mediatype ref="@mediatype"/>
           <xxforms:size ref="@size"/>
  </xforms:upload >
 
if u have not entered anything in upload button it is showing error that is ok.But if I upload file alse it is giving error.what is the problem.
 
plz help me.This is urgent requirement.
 
Thanks in advance,
Laxmi Narayana.
 


--
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: validation problem with upload button in ops xforms 3.5.1

fl.schmitt(ops-users)
hi Laxmi,

These mailing list threads may be of interest regarding this issue:
http://www.nabble.com/bind-%27readonly%27-to-upload-control--to6223917.html#a6435334
http://www.nabble.com/xforms%3Aupload-%40incremental-to6770242.html#a6770242

> I am using ops 3.5.1.

i've tested only with 3.6, so this may be inaccurate...

> <xforms:bind nodeset="//file" constraint=". != ''"/>

The problem may that this constraint will lead to a valid instance only _after_
a successful upload. And the upload submission itself will fail because the
instance seems still to be invalid. The upload control seems to be a little
special because the selected file name (path) isn't written into the instance,
as it would be the case with other xforms controls. So, checking the instance
with a xforms:bind@constraint isn't able to check whether a file was specified,
i think.

> control::
>   <xforms:upload ref="instance('main-instance')/file">
>                 <xforms:filename ref="@filename"></xforms:filename>
>                <xforms:mediatype ref="@mediatype"/>
>            <xxforms:size ref="@size"/>
>   </xforms:upload >

> if u have not entered anything in upload button it is showing error that
> is ok.But if I upload file alse it is giving error.what is the problem.

strange question - are you sure the file was uploaded? Maybe it wasn't. If you
added the validation contraint as described, the submission may throw an
xforms-submit-error because the submitted instance ins't estimated as valid. For
this, you may have to check the orbeon logs.

To make sure that the selected file gets uploaded, you mave to deactivate the
validation on submission (that is, add validation="false" to the upload submission).

You could do the following:

- deploy a stable version of orbeon forms (3.6) in a local tomcat;
- edit the WEB-INF/resources/apps/xforms-upload/view.xhtml:
     + in line 55, add a constraint=". != ''" to the xforms:bind
     + in line 69 (starting with .upload-table .xforms-alert), put a # at the
       start of the line (so any alerts are shown)
- run the Upload Control example in your browser and keep an eye on the
   instance inspector and the log.
     + when the page is freshly loaded, there should be red exclamation marks at

       the right of each of the upload controls because no file is selected;
     + select a file - the exclamation mark will stay;
     + push the upload button - nothing should happen in the browser, the
       instance inspector should not change, only the logs will show the
       validation error.
- edit the WEB-INF/resources/apps/xforms-upload/view.xhtml again:
     + in line 60, add a validation="false" to the xforms:submission

When running the Upload control example now, the selected file should get
uploaded, and the validation alert should disappear.


HTH
florian


--
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