3

I have a simple javascript code on a new item page, it limits the number of characters for a multi-line field. After I select someone in the people picker, the form does a quick postback and load, and my character limit no longer applies. Is there a way to reload my script once the people picker does its postback?

I am in Office 365, here is the character limit script, I should also mention this is a custom Infopath form:

function exploder(){
    $("#ctl00_ctl40_g_eefaaee7_0d73_4a99_9ea5_9baa41a0e15c_FormControl0_V1_I1_T22").attr("maxlength", "255");
}
function explodes(){
    $("#ctl00_ctl40_g_eefaaee7_0d73_4a99_9ea5_9baa41a0e15c_FormControl0_V1_I1_T23").attr("maxlength", "255");
}
setTimeout(exploder, 3000);
setTimeout(explodes, 3000);
4
  • What version are you using? in my SPOnline I tried creating a list with people picker and incorporated a script for the character limit and it works fine. no post back for people picker. Can you show me your js.
    – Aventus
    Aug 25, 2016 at 1:48
  • Kindly add Code snippet you wrote to apply Character Limit Aug 25, 2016 at 5:20
  • Did you found any solution ? I am having the same issue.
    – Mmomin
    Sep 2, 2016 at 17:44
  • I did find a solution, I posted it as an answer. Sep 3, 2016 at 5:29

1 Answer 1

0

This worked for me, it basically loops your javascript every two seconds. Just insert your code where it's noted and you can change the 2000 to any interval you want (1000 = 1 second)

<script>

  window.setInterval(function(){

    //code goes here

  }, 2000);

</script> 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.