smarty

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ajaymohank
    New Member
    • Jan 2008
    • 29

    smarty

    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.


    Code:
    {section name=ckbox loop=$profservices}
    				{if $smarty.section.ckbox.index==$profserv}
    				<tr><td>
    				<input type="checkbox" checked="checked" value="{$smarty.section.ckbox.index}" disabled="disabled" name="ckbx">{$profservices[ckbox]}</td></tr>
    				{/if}
    				{if $smarty.section.ckbox.index >='4' and $smarty.section.ckbox.index <='7'}
    				<tr><td><input type="checkbox" value="{$smarty.section.ckbox.index}" checked="checked" name="ckbx">{$profservices[ckbox]}</td></tr>
    				{/if}
    		{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'}
    				<tr><td><input type="checkbox" value="{$smarty.section.ckbox.index}" name="ckbx">{$profservices[$smarty.section.ckbox.index]}</td></tr>
    				
    				{/if}
    			
    					
    				  {/section}
    Thanks
    Last edited by Markus; Oct 14 '08, 10:46 AM. Reason: added [code] tags
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    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.

    Dan

    Comment

    Working...