Asp.Net C# Multiline textbox(textbox1) value split after 35 charaters of address & add to textbox(textbox2 - Singleline) again split next 35 charaters & add to textbox(textbox3 - Singleline) again split next 35 charaters & add to textbox(textbox4 - Singleline) again split next 35 charaters & add to textbox(textbox5 - Singleline). Note: While Splitting value after 35 characters make sure if a word is incomplete then add that word in next line like(...31 address - here at add position of address is 35 characters so it'll get slipt & gets add to new textbox, but I want that word address in new textbox & from their it should count to 35 charaters like so on.)
I've tried this but didn't work..
function CheckReturns() {
var txt = document.getElementById("TextBox1");
var splitResults = txt.value.split("\n");
if (splitResults[splitResults.length - 1].length < 35) {
if (splitResults[3].length > 0) {
document.getElementById('address4').value = splitResults[3];
}
return true;
}
else {
document.getElementById('address1').value = splitResults[0];
document.getElementById('address2').value = splitResults[1];
document.getElementById('address3').value = splitResults[2];
txt.value = txt.value + "\n";
}
}
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" MaxLength="140" Rows="10" Columns="60"
onblur="return CheckReturns();" placeholder="Enter Address here.."></asp:TextBox>
<br />
Address1:<asp:TextBox ID="address1" runat="server" Width="220px" ></asp:TextBox><br />
<br />
Address2:<asp:TextBox ID="address2" runat="server" Width="220px" ></asp:TextBox><br />
<br />
Address3:<asp:TextBox ID="address3" runat="server" Width="220px" ></asp:TextBox><br />
<br />
Address4:<asp:TextBox ID="address4" runat="server" Width="220px" ></asp:TextBox>