10 Kwi 2013

Odoblokowanie pola input, ustawionego na disabled

jQuery('#table input[type=radio]').click(function() {
  jQuery('#table input[type=button]').attr('disabled', 'disabled');
  let id=jQuery(this).attr('id');
  let id_btn='b'+id.substring(1,5);
  jQuery('#'+id_btn).removeAttr('disabled');
});
<div id="table">
<input id="k1" type="radio"><input id="b1" disabled="disabled">
<input id="k2" type="radio"><input id="b2" disabled="disabled">
<input id="k1" type="radio"><input id="b3" disabled="disabled">
</div>
30 Cze 2010

Przeformatowanie daty za pomoca funkcji str_pad

php:

$tstartdate = '2010-7-1';
$a_tstartdate = explode('-', $tstartdate);
$data_sd['d'] = str_pad($a_tstartdate[2], 2, '0', STR_PAD_LEFT);
$data_sd['m'] = str_pad($a_tstartdate[1], 2, '0', STR_PAD_LEFT);
$data_sd['y'] = $a_tstartdate[0];

smarty:

$smarty-&gt;assign('sd_data', $data_sd);

template:
Data wyjazdu:

<input type="text" value="!{$sd_data.d}!" disabled="disabled" size="2" />
<input type="text" value="!{$sd_data.m}!" disabled="disabled" size="2" />
<input type="text" value="!{$sd_data.y}!" disabled="disabled" size="4" />

wynik:
Data wyjazdu: 01 07 2010