List Info

Thread: HTML_QuickForm DHTML client rules and SoftRequired rule




HTML_QuickForm DHTML client rules and SoftRequired rule
user name
2006-03-26 07:54:25
At the request of a user I've made a QuickForm class which
alters the
client rule system to display errors with each field, much
like
QuickForm's default renderer normally does upon submission.
(Note that
I didn't try to make it *perfect*, I was just trying to get
it to work
 It
also supports running client rules when a field loses focus,
its value changes, or a key is pressed. For this last to
work you have
to call getValidationScript() before your form is rendered.

The way that this works depends a bit on the normal
renderer, but a
user could easily create divs to put the errors in a
specific place.

I've also looked again into the idea of a SoftRequired rule
which
makes an error show up the first time a user tries to submit
a field
without a value, then goes away if the form is submitted
again. I
tried before to create this as a normal QF rule, which is
nearly
impossible given QF's limited rule system. However, this
time I
limited it to a client rule and it works just fine (albeit
with a
simple hack to simulate a static variable).

http://pear.reversefold.com/qf_DHTMLRules_and_Soft
Required.php

Let me know what you think.

--
Justin Patrin

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

R: HTML_QuickForm DHTML client rules and SoftRequired rule
user name
2006-03-26 09:11:20
> -----Messaggio originale-----
> Da: Justin Patrin [mailto:papercranegmail.com] 
> Inviato: domenica 26 marzo 2006 9.54
> A: PEAR Dev List <pear-devlists.php.net>
> Oggetto: [ok] [PEAR-DEV] HTML_QuickForm DHTML client
rules 
> and SoftRequired rule
> 
> At the request of a user I've made a QuickForm class
which 
> alters the client rule system to display errors with
each 
> field, much like QuickForm's default renderer normally
does 
> upon submission. (Note that I didn't try to make it 
> *perfect*, I was just trying to get it to work
>  It also
supports running client rules when a field loses 
> focus, its value changes, or a key is pressed. For this
last 
> to work you have to call getValidationScript() before
your 
> form is rendered.
> 
> The way that this works depends a bit on the normal
renderer, 
> but a user could easily create divs to put the errors
in a 
> specific place.
> 
> I've also looked again into the idea of a SoftRequired
rule 
> which makes an error show up the first time a user
tries to 
> submit a field without a value, then goes away if the
form is 
> submitted again. I tried before to create this as a
normal QF 
> rule, which is nearly impossible given QF's limited
rule 
> system. However, this time I limited it to a client
rule and 
> it works just fine (albeit with a simple hack to
simulate a 
> static variable).
> 

This is a good job ;)
But... This is a series of client rule.
How can you make the same with server rules? AJAX?

If this rules are default rules, (e.g: when i set a server
rule
automatically a client DHTML rule is setted up)
this is a good idea.

Bye ;)

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

HTML_QuickForm DHTML client rules and SoftRequired rule
user name
2006-03-26 23:32:37
On 3/25/06, Justin Patrin <papercranegmail.com> wrote:
> At the request of a user I've made a QuickForm class
which alters the
> client rule system to display errors with each field,
much like
> QuickForm's default renderer normally does upon
submission. (Note that
> I didn't try to make it *perfect*, I was just trying
to get it to work
>  It also
supports running client rules when a field loses focus,
> its value changes, or a key is pressed. For this last
to work you have
> to call getValidationScript() before your form is
rendered.
>

I've just altered the class a bit to get rid of this
requirement. I
overrode the display() method so it calls
getValidationScript()
itself. If you don't use display() you'll still have to
add the extra
call to set up the JS event handlers.

> The way that this works depends a bit on the normal
renderer, but a
> user could easily create divs to put the errors in a
specific place.
>
> I've also looked again into the idea of a SoftRequired
rule which
> makes an error show up the first time a user tries to
submit a field
> without a value, then goes away if the form is
submitted again. I
> tried before to create this as a normal QF rule, which
is nearly
> impossible given QF's limited rule system. However,
this time I
> limited it to a client rule and it works just fine
(albeit with a
> simple hack to simulate a static variable).
>
> http://pear.reversefold.com/qf_DHTMLRules_and_Soft
Required.php
>
> Let me know what you think.
>
> --
> Justin Patrin
>


--
Justin Patrin

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )