FAQ

[PEAR] Quickform and Group Rules

Tom Melendez
Jun 4, 2004 at 3:53 pm
Hey folks,

We are just starting to use Quickform, and I have a question about using
the 'compare' rule for items in a group. I have two password boxes
(enter and verify) that are in a group (they are in a group because I
want them to appear on the same line, AND I want all elements, or
physical groups of elements to be wrapped in their own tables, it is my
understanding that this is the correct way to accomplish this. However,
I can't seem to get the rule to work. If I take the passwords out of
the group and add a rule using AddRule and that works fine.

Can I use 'compare' with AddGroupRule? How would that work?

Thanks for the QF help!

Tom
www.liphp.org
reply

Search Discussions

9 responses

  • Justin Patrin at Jun 4, 2004 at 4:12 pm

    Tom Melendez wrote:

    Hey folks,

    We are just starting to use Quickform, and I have a question about using
    the 'compare' rule for items in a group. I have two password boxes
    (enter and verify) that are in a group (they are in a group because I
    want them to appear on the same line, AND I want all elements, or
    physical groups of elements to be wrapped in their own tables, it is my
    understanding that this is the correct way to accomplish this. However,
    I can't seem to get the rule to work. If I take the passwords out of
    the group and add a rule using AddRule and that works fine.

    Can I use 'compare' with AddGroupRule? How would that work?

    Thanks for the QF help!

    Tom
    www.liphp.org

    You could always use a "form" rule and write your own function to check
    those elements.

    --
    paperCrane <Justin Patrin>
  • Alexey Borzov at Jun 4, 2004 at 4:44 pm
    Hi!

    Tom Melendez wrote:
    We are just starting to use Quickform, and I have a question about using
    the 'compare' rule for items in a group. I have two password boxes
    (enter and verify) that are in a group (they are in a group because I
    want them to appear on the same line, AND I want all elements, or
    physical groups of elements to be wrapped in their own tables, it is my
    understanding that this is the correct way to accomplish this. However,
    I can't seem to get the rule to work. If I take the passwords out of
    the group and add a rule using AddRule and that works fine.

    Can I use 'compare' with AddGroupRule? How would that work?
    There is a bug open for this already, but we couldn't (yet) come up with a
    resolution that is neither an ugly hack nor a BC break.
  • Tom Melendez at Jun 4, 2004 at 5:02 pm
    One more, related question.

    We are going to write a custom form rule for this as suggested by
    Justin, shouldn't be too bad at all. However, how to we register and
    use a custom form "client-side" (javascript) rule as well? I'm not
    exactly sure how to add my JS function to the QF code and have it
    evaluated.

    Thanks,

    Tom

    On Fri, 2004-06-04 at 12:44, Alexey Borzov wrote:
    Hi!

    Tom Melendez wrote:
    We are just starting to use Quickform, and I have a question about using
    the 'compare' rule for items in a group. I have two password boxes
    (enter and verify) that are in a group (they are in a group because I
    want them to appear on the same line, AND I want all elements, or
    physical groups of elements to be wrapped in their own tables, it is my
    understanding that this is the correct way to accomplish this. However,
    I can't seem to get the rule to work. If I take the passwords out of
    the group and add a rule using AddRule and that works fine.

    Can I use 'compare' with AddGroupRule? How would that work?
    There is a bug open for this already, but we couldn't (yet) come up with a
    resolution that is neither an ugly hack nor a BC break.
  • Alexey Borzov at Jun 4, 2004 at 7:07 pm
    Hi!

    Tom Melendez wrote:
    One more, related question.

    We are going to write a custom form rule for this as suggested by
    Justin, shouldn't be too bad at all. However, how to we register and
    use a custom form "client-side" (javascript) rule as well? I'm not
    exactly sure how to add my JS function to the QF code and have it
    evaluated.
    There is no way now, I'm afraid. Please open a bug for this.
  • Bertrand Mansion at Jun 4, 2004 at 8:23 pm

    Alexey Borzov wrote:
    Hi!

    Tom Melendez wrote:
    One more, related question.

    We are going to write a custom form rule for this as suggested by
    Justin, shouldn't be too bad at all. However, how to we register and
    use a custom form "client-side" (javascript) rule as well? I'm not
    exactly sure how to add my JS function to the QF code and have it
    evaluated.
    There is no way now, I'm afraid. Please open a bug for this.
    Well, you can. If you use a Callback rule with 'client' set, the callback will
    be called automatically in your javascript as well.

    Bertrand Mansion
    Mamasam
  • Matte Edens at Jun 4, 2004 at 8:54 pm
    Can someone provide some supporting code for this? I tried adding a
    callback rule set for 'client' on an element and it never rendered into
    my code. I had the supporting server-side function ready.

    --
    matte - matte@arubanetworks.com
    webmonkey / arubanetworks.com / airheads04.com / wi-fi-it.com


    Bertrand Mansion wrote:
    Alexey Borzov wrote:

    Tom Melendez wrote:

    One more, related question.

    We are going to write a custom form rule for this as suggested by
    Justin, shouldn't be too bad at all. However, how to we register and
    use a custom form "client-side" (javascript) rule as well? I'm not
    exactly sure how to add my JS function to the QF code and have it
    evaluated.
    There is no way now, I'm afraid. Please open a bug for this.
    Well, you can. If you use a Callback rule with 'client' set, the callback will
    be called automatically in your javascript as well.
  • Bertrand Mansion at Jun 4, 2004 at 9:02 pm

    Matte Edens wrote:
    Can someone provide some supporting code for this? I tried adding a
    callback rule set for 'client' on an element and it never rendered into
    my code. I had the supporting server-side function ready.
    You have to write the javascript yourself of course.
    QuickForm is not yet able to convert PHP to javascript code :)
    The only thing guaranteed is that your javascript function will be called when
    the user presses submit.

    Bertrand Mansion
    Mamasam
  • Alexey Borzov at Jun 5, 2004 at 6:45 am
    Hi!

    Bertrand Mansion wrote:
    We are going to write a custom form rule for this as suggested by
    Justin, shouldn't be too bad at all. However, how to we register and
    use a custom form "client-side" (javascript) rule as well? I'm not
    exactly sure how to add my JS function to the QF code and have it
    evaluated.
    There is no way now, I'm afraid. Please open a bug for this.
    Well, you can. If you use a Callback rule with 'client' set, the callback will
    be called automatically in your javascript as well.
    I know this. ;]

    I meant, there is no way to add a Javascript form rule right now, only a
    per-element one.
  • Bertrand Mansion at Jun 5, 2004 at 8:04 am

    Alexey Borzov wrote:
    Hi!

    Bertrand Mansion wrote:
    We are going to write a custom form rule for this as suggested by
    Justin, shouldn't be too bad at all. However, how to we register and
    use a custom form "client-side" (javascript) rule as well? I'm not
    exactly sure how to add my JS function to the QF code and have it
    evaluated.
    There is no way now, I'm afraid. Please open a bug for this.
    Well, you can. If you use a Callback rule with 'client' set, the callback will
    be called automatically in your javascript as well.
    I know this. ;]

    I meant, there is no way to add a Javascript form rule right now, only a
    per-element one.
    I see. Definately a missing feature then, that could be not too difficult to
    add.

    Bertrand Mansion
    Mamasam

Related Discussions

Discussion Navigation
viewthread | post