http://www.scriptcase.net/forum/showthread.php?7633-Best-way-to-do-this-in-Scriptcase-Display-Nicely-as-one-field-edit-as-multiple
Block1: 2 Label fields ({myaddress}, {mybtn}).
Block2: Address fields.
Create a javascript method (switchBlocks) with a variable (vswitch) to be passed in.
Code:
if(vswitch == 1)
{
document.getElementById('div_hidden_bloco_0').style.display = 'none'; //you need to determine the number of the block by inspecting the element in the browser
document.getElementById('div_hidden_bloco_1').style.display = 'block';
}
else
{
document.getElementById('div_hidden_bloco_0').style.display = 'block';
document.getElementById('div_hidden_bloco_1').style.display = 'none';
}
Code:
sc_ajax_javascript('switchBlocks',array(0)); //we need this because we can't call javascript from the onLoad event
Code:
{myaddress} = {name}.'<br>'.{address1}.'<br>'.{city}; {mybtn} = "<button type='button' onclick='switchBlocks(1)'>Edit</button>"; //could be beefed up with some css call_switchBlocks();
Code:
call_switchBlocks();
自行建立欄位:{sam_addr_btn}
在 onLoad Event裡建立
{same_addr_btn1}="<button type='button' onclick='sameaddress1()'>Same Address</button>";
在 Javascript Methods建立一個 sameaddress
code:
$("select[name$='m_country_id']" ).val($("select[name$='country_id']").val());
$("input[name$='m_state']" ).val($("input[name$='state']").val());
$("input[name$='m_city']" ).val($("input[name$='city']").val());
$("input[name$='m_postcode']" ).val($("input[name$='postcode']").val());
$("input[name$='m_street1']" ).val($("input[name$='street1']").val());
$("input[name$='m_street2']" ).val($("input[name$='street2']").val());
沒有留言:
張貼留言