You are viewing limited content. For full access, please sign in.

Question

Question

Make field read-only until form has completely loaded

asked on June 26, 2016

I have a form using a lookup from a database and if the user selects it before the page is 100% loaded, it returns the default values (Choice 1, Choice 2, etc.).  Is there a way to use Javascript to prevent this?  I'm thinking it should be pretty straight forward, but I'm not sure what the 'load complete' trigger is.  Any help is much appreciated.  

Cheers,

Nate

0 0

Replies

replied on June 28, 2016

It's not doable to check whether the lookup has completed or not using JavaScript. One workaround maybe check how long it usually takes for the request http://[formserver]/Forms/form/autopopulate?formId=x using browser developer tool then set the field to be readonly during that period of time. For example, I found my lookup rule take usually 3 seconds to finish, then I use following code to set the dropdown readonly for 3 seconds:

$(document).ready(function () {

    $('.dropdown select').attr('readonly',true);  
  setTimeout(function(){
     $('.dropdown select').attr('readonly',false);         
  },3000);
  
});

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.