Jump to content

Smarty Code With Select And Change Function


safey

Recommended Posts

I have two columns in a table , first column has a select and the second has a list of checkboxes

I'm using smarty to get the number of rows of the table from php , then I use a loop in script code to generate onchange event for every select cell in the table ,

I'm lost with syntax ! what I want that when I change the select options the checkboxes in the second cloumn become readonly or not . depeanding on the select option which has been chosen .

when I open the source of the page I find that there's no code generated in the script at all , it's like the smarty code is ignored

need your help to fing the error .

 

the script :

 

<script type="text/javascript">

	 $(document).ready(function() {
		 <%section name='i' start=0 loop=$rows_number%>
	 $('col_order<%$smarty.section.i.index%>').change(function(){
		 if( $('col_order<%$smarty.section.i.index%>').val=='first')
			 {
				 $("col_list<%$smarty.section.i.index%>_0").attr('selected','y');
				 $("col_list<%$smarty.section.i.index%>_0").attr('disabled',false);

				 $("col_list<%$smarty.section.i.index%>_1").attr('selected','y');
				 $("col_list<%$smarty.section.i.index%>_1").attr('disabled',false);
			 }
		 else if( $('col_order<%$smarty.section.i.index%>').val=='second')
			 {
				 $("col_list<%$smarty.section.i.index%>_0").attr('selected','n');
				 $("col_list<%$smarty.section.i.index%>_0").attr('disabled',true);

				 $("col_list<%$smarty.section.i.index%>_1").attr('selected','n');
				 $("col_list<%$smarty.section.i.index%>_1").attr('disabled',true);
			 }
	 });
});
 <%/section%>

</script>

I've never seen anything that says Smarty can use those tags. Where did you see that? If you need to enable something to use those tags maybe check on that.

 

Edit: http://www.smarty.net/docs/en/language.escaping.tpl

 

Did you set them in your PHP?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.