Hmm okay,

Then you probably have to go trough all widgets. The lookupWidget method
takes some sort of Xpath string to lookup some widget (if I'm not
wrong), but I don't know (and don't think) that you can use "*"... But
as I said I don't know.

Otherwise, you can always get the form, walk over it's children and
check those, and if a child is a container, then recursively check its
children again. I wouldn't know how to do this faster...

> -----Original Message-----
> From: Philipp Rech [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 03, 2004 1:49 PM
> To: [EMAIL PROTECTED]
> Subject: RE: CForms: how 2 lookup all widgets at once
> 
> okay i am using these features for validation already. what i need
here is
> the feature that the user will be notified when he has filled out all
> fields
> (also the ones who are NOT required!) I want to display a check mark
or
> change the color of the link or alert something (whatever)...
> 
> so i use this in the form definition:
> 
> <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition";>
> <fd:validation>
>     <fd:javascript>
> 
> if (widget.lookupWidget("*") != "null"){
>                 //the alert is just a test, could be other DHTML
features
>               alert("You are done");
> 
> }
>     </fd:javascript>
>   </fd:validation>
> <fd:widgets>
> 
> The question is >>if (widget.lookupWidget("*") != "null")<< okay?
> And why do I get that error:
> 
> "file:/C:/Programme/Diplom/Apache Software Foundation/Tomcat
> 5.0/webapps/cocoon/bihs-t7/cform-definitions/widgets_table_event.xml",
> line
> 9: uncaught JavaScript exception: at bihs
> (file:/C:/Programme/Diplom/Apache
> Software Foundation/Tomcat
5.0/webapps/cocoon/bihs-t7/flowscripts/bihs.js,
> Line 21) at
(resource://org/apache/cocoon/forms/flow/javascript/Form.js,
> Line 127): ReferenceError: "alert" is not defined.
> (file:/C:/Programme/Diplom/Apache Software Foundation/Tomcat
> 5.0/webapps/cocoon/bihs-t7/cform-definitions/widgets_table_event.xml;
line
> 9)
> 
> Thank you!
> philipp
> 
> 
> 
> 
> 
> > You can do this much easier by defining validation rules on the form
> > definition. There are a number of validation rules available,
including
> > a rule that uses javascript to validate. See the Cocoon docs:
> >
> > http://cocoon.apache.org/2.1/userdocs/forms/validation.html
> >
> >
> > > -----Original Message-----
> > > From: Philipp Rech [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, November 03, 2004 10:41 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: CForms: how 2 lookup all widgets at once
> > >
> > > Hello,
> > >
> > > i am looking for a Flowscript functionality that checks (at once)
if
> > all
> > > fields in a form are selected or filled out (not empty).
> > >
> > > --- the flow part -------
> > >
> > >  if (widget.lookupWidget(*) == NULL) {
> > > >>>>display a hint that you are done here>>>
> > > }
> > > -------------------------
> > >
> > > I am not shure how to check all widgets at once? The
> > > "widget.lookupWidget(*) == NULL"
> > > was just a guess... *wonders*
> > >
> > > I am using CForms within Cocoon (2.1.5.1).
> > > Thank you in advance,
> > > phil
> > >
> > >
> > >
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to