troubleshooting Question

ul li list with unique id in Zend_Form using decorator

Avatar of midhungirish
midhungirishFlag for Heard Island and McDonald Islands asked on
PHPWeb Frameworks
4 Comments1 Solution1222 ViewsLast Modified:
hi everyone,

I need to make the attached html using Zend form and form decorators... Please see the attached php code is use.... The output is not exactly wht i want.... Each li tag needs to have a unique id so tht i can use some js to do some client side validations and modifications......  Im beginning to use Zend_form and the decorators are a bit confusing ......Please do help...
$userelement = new Zend_Form_Element_MultiCheckbox ( 'users' );
		$userelement-> setRequired(true)
		->addDecorator("<li>")
		->addMultiOptions ( array ('1' => 'User One', '2' => 'User Two', '3' => 'User Three', '4' => 'User Four' ) )
		->setSeparator ( '</li><li>' )->addValidator('NotEmpty', true)
		->addErrorMessage('Please select atleast one user');
		$userelement->class = 'textbox';
<ul>
	<li id="containeruser1">
		<label for="user1"><input type="checkbox" class="textbox"  value="1" id="user1" name="users[]">User One</label>
	</li>
	<li id="containeruser2">
		<label for="user2"><input type="checkbox" class="textbox"  value="2" id="user2" name="users[]">User Two</label>
	</li>
	<li id="containeruser3">
		<label for="user3"><input type="checkbox" class="textbox"  value="3" id="user3" name="users[]">User Three</label>
	</li>
	<li id="containeruser4">
		<label for="user4"><input type="checkbox" class="textbox"  value="4" id="user4" name="users[]">User Four</label>
	</li>
</ul>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros