I'm creating a form helper that generates your html with all validation
from the model in place (This keeps the validation rules out of your
view 100%). I'm using it kind of like this:

<form action="<?=$BASE?>/properties/save" method="post">

<?php if (isset($validations) || isset($data))
$myform->init(@$validations, @$data); ?>
<fieldset>
        <legend>Property Information</legend>
        <?php echo $myform->hidden(array('id'=>'Property/id'))?>
        <?php echo $myform->text(array('id'=>'Property/year_built',
'attrib'=>'size="5"'))?>
        <?php echo $myform->text(array('id'=>'Property/price',
'attrib'=>'size="10"'))?>
        <?php echo $myform->text(array('id'=>'Property/short_title'))?>
        <?php echo $myform->select(array('id'=>'Property/beds',
'options'=>array(0,1,2,3,4,5,6,7,8,9,10)))?>
....etc.

But it would really simplify the writing of this class if I could use a
beforeFilter on the helper, so that before each of those field
functions is called (ie. text(), hidden(), select(), etc.), an
initialization function would be called to set the validation rules,
field parameters, etc., for the field so I don't have to do again in
every function.

Is this possible or should I be doing this a different way?
Also, if anyone is interested in this idea of quick & simple form
creation, let me know and I'll put it on the wiki or something so
others can take a stab at it too.

Thanks,
Brandon


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to