Hi all,
Created dynamic text field in suitecrm but not save in database and not redirect edit view page in suitecrm. please any one help me.
This is my code sir.
Custom/modules/your modules name /metadata/editviewdefs.php
4 =>
array (
0 =>
array (
'name' => 'Link',
'LBL_LINK' => 'Link1',
'customCode' => '<table ><tr><td><button onclick="javascript:add_phoneNumber()" id="add_email" type="button"><img alt="Array.LBL_ID_FF_ADD" src="themes/default/images/id-ff-add.png?v=jlL480K5YkTHsr6Wx8BATQ"></button></td></tr><tr><td><input type="text" name="phone_0" value="" size="30"/><input type="hidden" name="phone_count" id="phone_count" value="0"/></td></tr></table><table id="tbl_phone"></table>',
),
),
Next i have created js file.
var add_phoneNumber = function(){
var phone_count = parseInt($(’#phone_count’).val());
var incr_count = phone_count + 1;
var select_phonetype = ‘HomeOffice PhoneMobileFaxAlternateOthers’;
str_append = ‘
$("#tbl_phone").last().append(str_append);
$(’#phone_count’).val(incr_count);
}
var remove_phoneNumber = function(res){
var decr_count = parseInt($(’#phone_count’).val()) -1;
$(res).closest( ‘tr’).remove();
$(’#phone_count’).val(decr_count);
resetTheOrder();
}
function resetTheOrder(){
var input = $(’#tbl_phone input’).attr(‘name’,’’);
var select_val = $(’#tbl_phone select’).attr(‘name’,’’);
var button = $(’#tbl_phone button’).attr(‘name’,’’);
$.each(input,function(index,value){
var incr_val = index+1;
$(value).attr(‘name’,‘phone_’+incr_val).prop(‘id’,‘phone_’+incr_val);
});
$.each(select_val,function(index,value){
var incr_val = index+1;
$(value).attr(‘name’,‘sel_’+incr_val).prop(‘id’,‘sel_’+incr_val);
});
$.each(button,function(index,value){
var incr_val = index+1;
$(value).attr(‘name’,incr_val).prop(‘id’,incr_val);
});
}
This is my code sir how will redirect and save sir please help any one.