Jump to content

Recommended Posts

Hi peeps.

 

In need of a bit of assistance with zend form...

 

I need to create a form with multicheckbox and have a text box associated with that checkbox.

 

I can handle to output but its building the form itself - the mark up needed would be something like

 

<form>
<dl>
<dt></dt>
<dd>
<label><input type="checkbox" name="id[]" id="id-1" value="1" />Text 1</label> <label for="text-1">Title:</label><input type="text" name="text[]" id="text-1" />
<br />
<label><input type="checkbox" name="id[]" id="id-2" value="2" />Text 2</label> <label for="text-2">Title:</label><input type="text" name="text[]" id="text-2" />
</dd>
</dl>
</form>

 

I've not got to custom decorators or view helpers yet but suspect that this is a case where I'm gonna need it.

 

ANy help would be very much appreciated...

Link to comment
https://forums.phpfreaks.com/topic/203709-zend-form/
Share on other sites

Thanks ignace...

 

Yeah I can see how that is going to work...

 

Any chance of an example of how you would get the form rendered like in my example?

 

I need the text box to be implicitly associated with its corresponding checkbox within the markup..

 

Apologies for noobieness liking this framework a lot and picking bits up quickly but this one is a bit beyond me right now.

Link to comment
https://forums.phpfreaks.com/topic/203709-zend-form/#findComment-1067169
Share on other sites

As an appendage to that last post...

 

Is it possible to get zend from to render array type elements alternating fasion?

 

so in the case of

 

$form->addElement('Checkbox', 'id', array('isArray' => true));

$form->addElement('Text', 'text', array('isArray' => true));

 

it could output

 

<input type="checkbox" name="id[]" /><input type="text" name="text[]" />

<input type="checkbox" name="id[]" /><input type="text" name="text[]" />

<input type="checkbox" name="id[]" /><input type="text" name="text[]" />

<input type="checkbox" name="id[]" /><input type="text" name="text[]" />

Link to comment
https://forums.phpfreaks.com/topic/203709-zend-form/#findComment-1067699
Share on other sites

Thanks ignace...

 

Yeah I can see how that is going to work...

 

Any chance of an example of how you would get the form rendered like in my example?

 

I need the text box to be implicitly associated with its corresponding checkbox within the markup..

 

Apologies for noobieness liking this framework a lot and picking bits up quickly but this one is a bit beyond me right now.

 

Tell your form not to auto-load it's default decorators. Then write your custom decorators and add them. Look at the API for more information till' now I never needed to use custom decorators.

Link to comment
https://forums.phpfreaks.com/topic/203709-zend-form/#findComment-1067747
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.