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>

Edited by safey
Link to comment
Share on other sites

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?

Edited by Jessica
Link to comment
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.