20 mar 2012

Zmiana wartości opcji selecta

Zmiana wartości opcji selecta

$('#right table td input[name=imie]').parent().parent().parent().css({'display':'none'});
$('#right table .teh').parent().parent().parent().parent().css({'display':'none'});
$('#right table td select[name=stanowisko] option:eq(0)').replaceWith("Zamiana wartości text");
$('#right table td select[name=stanowisko]').parent().prev().html('Zmiana tytułu labela nad selectem taki');
$('#right table td select[name=stanowisko]').val('0');
20 mar 2012

Dynamiczne utworzenie nazwy zmiennej

Utworzenie zmiennej

!{assign var=tmp_work value="imp_1_dzien_"|cat:$w_data[ii].work_day|cat:"_pozycja_"|cat:$w_data[ii].work_id}!
!{assign var=check_work value="check_"|cat:$tmp_work}!
!{if $get_data.$check_work}! checked!{/if}!

Wykorzystanie w pętli

!{section name=ii loop=$w_data}!
<tr>
!{assign var=tmp_work value="imp_1_dzien_"|cat:$w_data[ii].work_day|cat:"_pozycja_"|cat:$w_data[ii].work_id}! !{assign var=check_work value="check_"|cat:$tmp_work}! </td>
<td><input type="checkbox" name="check_!{$tmp_work}!" value="1"!{if $get_data.$check_work}! checked!{/if}!/></td> <td><label for="!{$tmp_work_name}!">!{$w_data[ii].work_day}!</span>dzień</strong> !{$w_data[ii].work_date|date_format:"%Y-%m-%d"}!</td>
</tr>
!{/section}!