By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,550 Members | 875 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,550 IT Pros & Developers. It's quick & easy.


P: 29
hello friends.......... i am new to smarty. can anyone please tell me how to get the value from a dynamically generated checkbox using smarty. this is the code i used... here i am generating 10 checkbox. but i am not getting the value when each checkbox is checked. the value is coming from the array $profservices. how can i get the value from each checkbox when they are selected. also i have a "Select all" checkbox generated. how will i write its code. ie: how can i get all the checkbox dynamically generated selected when clicking the "select all"checkbox.

Expand|Select|Wrap|Line Numbers
  1. {section name=ckbox loop=$profservices}
  2.                 {if $smarty.section.ckbox.index==$profserv}
  3.                 <tr><td>
  4.                 <input type="checkbox" checked="checked" value="{$smarty.section.ckbox.index}" disabled="disabled" name="ckbx">{$profservices[ckbox]}</td></tr>
  5.                 {/if}
  6.                 {if $smarty.section.ckbox.index >='4' and $smarty.section.ckbox.index <='7'}
  7.                 <tr><td><input type="checkbox" value="{$smarty.section.ckbox.index}" checked="checked" name="ckbx">{$profservices[ckbox]}</td></tr>
  8.                 {/if}
  9.         {if $smarty.section.ckbox.index!=$profserv and $smarty.section.ckbox.index!='4' and $smarty.section.ckbox.index !='5' and $smarty.section.ckbox.index!='6' and $smarty.section.ckbox.index !='7'}
  10.                 <tr><td><input type="checkbox" value="{$smarty.section.ckbox.index}" name="ckbx">{$profservices[$smarty.section.ckbox.index]}</td></tr>
  12.                 {/if}
  15.                   {/section}
Oct 14 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,584
this doesn't have much to do with smarty, once the page load, smarty and PHP are done doing their thing, you need to use JavaScript.

Oct 15 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.