I am trying to trim strings inside a modal box. I have attempted trimming the strings with regex and shortened available characters in MVC. I am still struggling with getting the intended result i am looking for. Any suggestions would be great! Thank you.
$("#divUpdateAddress").css("display", "block");
var p = $.ajax({
url: '/Portal/ChangeAddress',
data: { 'type': profileType, policyno: $('#liPolicyNo').html() },
cache: false,
contentType: 'application/json; charset=utf-8',
async: false,
sucess: function (data) {
aa($.parseJSON(data));
},
error: function (data) {
debugger;
alert(data[0]);
}
}).responseText;
$("#divUpdateAddress").html($.parseJSON(p).update_section.html);
$('#divUpdateAddress').dialog("open");
$(".ui-dialog-title").html(header);
});
$('#divUpdateAddress').dialog({
autoOpen: false,
width: 800,
resizable: false,
draggable: true,
title: 'Update Address',
modal: true,
show: { effect: 'blind' },
open: function (event, ui) {
}
});
});
<ol class="row">
<li class="cell" style="width: 20%;">Phone Number:</li>
<li class="cell last" style="width: 60%;">
@Html.TextBoxFor(model => model.PhoneNumber, new { @class = "textbox", maxlength = 15 }) @Html.ValidationMessageFor(model => model.PhoneNumber)
</li>
[DataType(DataType.PhoneNumber)]
[Required(ErrorMessage = "Phone Number Required!")]
[RegularExpression(@"^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})\s+\Z$", ErrorMessage = "Entered phone format is not valid.")]