You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Philipp Rech <ph...@gmx.de> on 2004/10/13 10:42:29 UTC

CForms: immediate validation of input fields

Hello Cocooners!

I have a CFrom with many fields and other input elements. Validation (based
on the Cforms validation tags) happens when i submit the form. So far so
good. Now is it possible (and how) to have Cforms validate user inputs right
away after one field is filled out? So can I call the validation not only on
submit but also when the user focuses (clicks on) the next field on the
page? Maybe through the Javascript "onBlur" event handler?

Thank you in advance!
philipp


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms: immediate validation of input fields

Posted by Philipp Rech <ph...@gmx.de>.
thank you guys! that helped a lot. 
the <fi:styling onBlur="test();">
works fine too. thank you for that hint!

so i guess there can be a 3-level validation (used seperate OR together):

1- client-side via custom javascript through <fi:styling onBlur="xyz">
2- server-side both, the widget validation AND the fd:javascript stuff
3- application level in the database (or simular applications)

right?

regards,
philipp




> I think that they were aiming to support more browsers by leaving most 
> actions on the server-side. Validation on server-side or client-side is, 
> in the end, a difference of opinion as you said. So you're right to 
> suggest a mechanism to choose between both. Like an attribute defining 
> "client-side" or "server-side" on each widget, and one default setting. 
> It's not there yet and I don't know if the developers are already 
> discussing/implementing  this issue.
> 
> Kind Regards,
> Jan
> 
> Gunter D'Hondt wrote:
> 
> > CForms still doesn't have any clientside validations, which in my 
> > opinion is currently a huge disadvantage coz now you have to declare 
> > the specifications (datatype, required, format) in the form definition 
> > and again in your own clientside javascript stuff. It would be perfect 
> > that the CFormTemplateTransformer could automatically create those 
> > clientside javascript pieces or at least give a javascript-structure 
> > with the metadata of each field in it.
> >
> > Regards,
> >
> > Gunter D'Hondt.
> >
> >
> >
> >
> > *Jan Hoskens <jh...@schaubroeck.be>*
> >
> > 14-10-2004 10:17
> > Please respond to
> > users@cocoon.apache.org
> >
> >
> > 	
> > To
> > 	users@cocoon.apache.org
> > cc
> > 	
> > Subject
> > 	Re: CForms: immediate validation of input fields
> >
> >
> >
> > 	
> >
> >
> >
> >
> >
> > If I am correct, all stuff happens server-side. The fd:javascript will
> > happen at the same moment as the other validations (meaning sever-side,
> > on-submit). If you really want to have a client-side validation, you  
> > can try to set some extra stuff in your template:
> >
> > <ft:widget id=" ... "><fi:styling onchange=""></ft:widget>
> >
> > The fi:styling attributes that are not used by the cform stylesheets
> > will be copied into your html input element (ending up with <input ....
> > onchange=""/>). So you can set a javascript piece in which you validate
> > your field in those attributes.
> >
> > Kind Regards,
> > Jan
> >
> > Jorg Heymans wrote:
> >
> > > fd:javascript should be your friend here i think.
> > >
> > > http://cocoon.apache.org/2.1/userdocs/forms/validation.html
> > >
> > > Philipp Rech wrote:
> > >
> > >> Hello Cocooners!
> > >>
> > >> I have a CFrom with many fields and other input elements. Validation
> > >> (based
> > >> on the Cforms validation tags) happens when i submit the form. So 
> > far so
> > >> good. Now is it possible (and how) to have Cforms validate user
> > >> inputs right
> > >> away after one field is filled out? So can I call the validation not
> > >> only on
> > >> submit but also when the user focuses (clicks on) the next field on
> the
> > >> page? Maybe through the Javascript "onBlur" event handler?
> > >>
> > >> Thank you in advance!
> > >> philipp
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms: immediate validation of input fields

Posted by Gunter D'Hondt <gu...@sofico.be>.
Ofcoz multi-browser support isn't the easiest thing but it would already 
be very handy if CForms automatically generates a js-structure with the 
specification of each widget; for example:
aField = {required=true,datatype="datetime",format="dd/mm/yyyy"};
...

Then you've got all necessary data and metadata on the clientside and 
everybody can produce it's own specific functions 
(onblur,onchange,onclick,onsubmit,...) etc;

Gunter





Jan Hoskens <jh...@schaubroeck.be> 
14-10-2004 10:48
Please respond to
users@cocoon.apache.org


To
users@cocoon.apache.org
cc

Subject
Re: CForms: immediate validation of input fields






I think that they were aiming to support more browsers by leaving most 
actions on the server-side. Validation on server-side or client-side is, 
in the end, a difference of opinion as you said. So you're right to 
suggest a mechanism to choose between both. Like an attribute defining 
"client-side" or "server-side" on each widget, and one default setting. 
It's not there yet and I don't know if the developers are already 
discussing/implementing  this issue.

Kind Regards,
Jan

Gunter D'Hondt wrote:

> CForms still doesn't have any clientside validations, which in my 
> opinion is currently a huge disadvantage coz now you have to declare 
> the specifications (datatype, required, format) in the form definition 
> and again in your own clientside javascript stuff. It would be perfect 
> that the CFormTemplateTransformer could automatically create those 
> clientside javascript pieces or at least give a javascript-structure 
> with the metadata of each field in it.
>
> Regards,
>
> Gunter D'Hondt.
>
>
>
>
> *Jan Hoskens <jh...@schaubroeck.be>*
>
> 14-10-2004 10:17
> Please respond to
> users@cocoon.apache.org
>
>
> 
> To
>                users@cocoon.apache.org
> cc
> 
> Subject
>                Re: CForms: immediate validation of input fields
>
>
>
> 
>
>
>
>
>
> If I am correct, all stuff happens server-side. The fd:javascript will
> happen at the same moment as the other validations (meaning sever-side,
> on-submit). If you really want to have a client-side validation, you 
> can try to set some extra stuff in your template:
>
> <ft:widget id=" ... "><fi:styling onchange=""></ft:widget>
>
> The fi:styling attributes that are not used by the cform stylesheets
> will be copied into your html input element (ending up with <input ....
> onchange=""/>). So you can set a javascript piece in which you validate
> your field in those attributes.
>
> Kind Regards,
> Jan
>
> Jorg Heymans wrote:
>
> > fd:javascript should be your friend here i think.
> >
> > http://cocoon.apache.org/2.1/userdocs/forms/validation.html
> >
> > Philipp Rech wrote:
> >
> >> Hello Cocooners!
> >>
> >> I have a CFrom with many fields and other input elements. Validation
> >> (based
> >> on the Cforms validation tags) happens when i submit the form. So 
> far so
> >> good. Now is it possible (and how) to have Cforms validate user
> >> inputs right
> >> away after one field is filled out? So can I call the validation not
> >> only on
> >> submit but also when the user focuses (clicks on) the next field on 
the
> >> page? Maybe through the Javascript "onBlur" event handler?
> >>
> >> Thank you in advance!
> >> philipp
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



Re: CForms: immediate validation of input fields

Posted by Jan Hoskens <jh...@schaubroeck.be>.
I think that they were aiming to support more browsers by leaving most 
actions on the server-side. Validation on server-side or client-side is, 
in the end, a difference of opinion as you said. So you're right to 
suggest a mechanism to choose between both. Like an attribute defining 
"client-side" or "server-side" on each widget, and one default setting. 
It's not there yet and I don't know if the developers are already 
discussing/implementing  this issue.

Kind Regards,
Jan

Gunter D'Hondt wrote:

> CForms still doesn't have any clientside validations, which in my 
> opinion is currently a huge disadvantage coz now you have to declare 
> the specifications (datatype, required, format) in the form definition 
> and again in your own clientside javascript stuff. It would be perfect 
> that the CFormTemplateTransformer could automatically create those 
> clientside javascript pieces or at least give a javascript-structure 
> with the metadata of each field in it.
>
> Regards,
>
> Gunter D'Hondt.
>
>
>
>
> *Jan Hoskens <jh...@schaubroeck.be>*
>
> 14-10-2004 10:17
> Please respond to
> users@cocoon.apache.org
>
>
> 	
> To
> 	users@cocoon.apache.org
> cc
> 	
> Subject
> 	Re: CForms: immediate validation of input fields
>
>
>
> 	
>
>
>
>
>
> If I am correct, all stuff happens server-side. The fd:javascript will
> happen at the same moment as the other validations (meaning sever-side,
> on-submit). If you really want to have a client-side validation, you  
> can try to set some extra stuff in your template:
>
> <ft:widget id=" ... "><fi:styling onchange=""></ft:widget>
>
> The fi:styling attributes that are not used by the cform stylesheets
> will be copied into your html input element (ending up with <input ....
> onchange=""/>). So you can set a javascript piece in which you validate
> your field in those attributes.
>
> Kind Regards,
> Jan
>
> Jorg Heymans wrote:
>
> > fd:javascript should be your friend here i think.
> >
> > http://cocoon.apache.org/2.1/userdocs/forms/validation.html
> >
> > Philipp Rech wrote:
> >
> >> Hello Cocooners!
> >>
> >> I have a CFrom with many fields and other input elements. Validation
> >> (based
> >> on the Cforms validation tags) happens when i submit the form. So 
> far so
> >> good. Now is it possible (and how) to have Cforms validate user
> >> inputs right
> >> away after one field is filled out? So can I call the validation not
> >> only on
> >> submit but also when the user focuses (clicks on) the next field on the
> >> page? Maybe through the Javascript "onBlur" event handler?
> >>
> >> Thank you in advance!
> >> philipp
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms: immediate validation of input fields

Posted by Gunter D'Hondt <gu...@sofico.be>.
CForms still doesn't have any clientside validations, which in my opinion 
is currently a huge disadvantage coz now you have to declare the 
specifications (datatype, required, format) in the form definition and 
again in your own clientside javascript stuff. It would be perfect that 
the CFormTemplateTransformer could automatically create those clientside 
javascript pieces or at least give a javascript-structure with the 
metadata of each field in it. 
Regards,
Gunter D'Hondt.





Jan Hoskens <jh...@schaubroeck.be> 
14-10-2004 10:17
Please respond to
users@cocoon.apache.org


To
users@cocoon.apache.org
cc

Subject
Re: CForms: immediate validation of input fields






If I am correct, all stuff happens server-side. The fd:javascript will 
happen at the same moment as the other validations (meaning sever-side, 
on-submit). If you really want to have a client-side validation, you 
can try to set some extra stuff in your template:

<ft:widget id=" ... "><fi:styling onchange=""></ft:widget>

The fi:styling attributes that are not used by the cform stylesheets 
will be copied into your html input element (ending up with <input .... 
onchange=""/>). So you can set a javascript piece in which you validate 
your field in those attributes.

Kind Regards,
Jan

Jorg Heymans wrote:

> fd:javascript should be your friend here i think.
>
> http://cocoon.apache.org/2.1/userdocs/forms/validation.html
>
> Philipp Rech wrote:
>
>> Hello Cocooners!
>>
>> I have a CFrom with many fields and other input elements. Validation 
>> (based
>> on the Cforms validation tags) happens when i submit the form. So far 
so
>> good. Now is it possible (and how) to have Cforms validate user 
>> inputs right
>> away after one field is filled out? So can I call the validation not 
>> only on
>> submit but also when the user focuses (clicks on) the next field on the
>> page? Maybe through the Javascript "onBlur" event handler?
>>
>> Thank you in advance!
>> philipp
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



Re: CForms: immediate validation of input fields

Posted by Jan Hoskens <jh...@schaubroeck.be>.
If I am correct, all stuff happens server-side. The fd:javascript will 
happen at the same moment as the other validations (meaning sever-side, 
on-submit). If you really want to have a client-side validation, you  
can try to set some extra stuff in your template:

<ft:widget id=" ... "><fi:styling onchange=""></ft:widget>

The fi:styling attributes that are not used by the cform stylesheets 
will be copied into your html input element (ending up with <input .... 
onchange=""/>). So you can set a javascript piece in which you validate 
your field in those attributes.

Kind Regards,
Jan

Jorg Heymans wrote:

> fd:javascript should be your friend here i think.
>
> http://cocoon.apache.org/2.1/userdocs/forms/validation.html
>
> Philipp Rech wrote:
>
>> Hello Cocooners!
>>
>> I have a CFrom with many fields and other input elements. Validation 
>> (based
>> on the Cforms validation tags) happens when i submit the form. So far so
>> good. Now is it possible (and how) to have Cforms validate user 
>> inputs right
>> away after one field is filled out? So can I call the validation not 
>> only on
>> submit but also when the user focuses (clicks on) the next field on the
>> page? Maybe through the Javascript "onBlur" event handler?
>>
>> Thank you in advance!
>> philipp
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms: immediate validation of input fields

Posted by Jorg Heymans <jh...@domek.be>.
fd:javascript should be your friend here i think.

http://cocoon.apache.org/2.1/userdocs/forms/validation.html

Philipp Rech wrote:
> Hello Cocooners!
> 
> I have a CFrom with many fields and other input elements. Validation (based
> on the Cforms validation tags) happens when i submit the form. So far so
> good. Now is it possible (and how) to have Cforms validate user inputs right
> away after one field is filled out? So can I call the validation not only on
> submit but also when the user focuses (clicks on) the next field on the
> page? Maybe through the Javascript "onBlur" event handler?
> 
> Thank you in advance!
> philipp


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org