Zend Form - how do I create these custom form elements?

Posted by Jeremy Hicks on Stack Overflow See other posts from Stack Overflow or by Jeremy Hicks
Published on 2010-06-08T14:45:00Z Indexed on 2010/06/09 18:12 UTC
Read the original article Hit count: 284

Filed under:
|

This is a very specific instance where I'm having difficulty getting Zend Form to produce the correct output and supply the correct validation. I may have to go create a composite element but thought I'd ask here first. Here is the HTML I'm trying to get Zend Form to produce. I'd like this to be able to work where if the validation doesn't pass that the error messages still show up inline with the field that produced the error.

<tr>
    <td>Budget</td>
    <td>
        <input type="radio" name="budget" value="unlimited" /> unlimited
        <br />
        <input type="radio" name="budget" value="limited" /> $ <input type="text" name="budget_amount" /> every <select name="budget_period">
            <option value="day">day</option>
            <option value="week">week</option>
            <option value="month">month</option>
            <option value="year">year</option>
        </select>
    </td>
</tr>
<tr>
    <td></td>
    <td><input type="checkbox" name="include_weekends" value="yes" /> include weekends?</td>
</tr>

The user can choose either unlimited or limited for the budget value, however, if they choose limited, then they are required to enter a value for the budget amount field and choose a value from the select for the budget period field.

© Stack Overflow or respective owner

Related posts about zend-form

Related posts about decorators