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

Question

Question

focus on a specific field in the form

asked on June 21, 2017

Hi,

Does anyone know of a way to make the focus on a particular field in laserfiche forms?  I have tried to do this in javascript, but to no avail.

I have a form, and once the user fills in one field, a bunch of other fields get automatically populated based on a database look-up rule.  What I would like to do, at that point, is make the focus go to the next field which has not been automatically populated.  Can this be done in laserfiche?

Thanks...................................................................Sheela.

 

0 0

Replies

replied on June 21, 2017

You can do this with JavaScript

$(document).ready(function(){
  $('#YourField input').focus();
});

Just replace "YourField" with the id of your field (q2, q15, etc.). If you are using a multiline you would swap out "input" for "textarea" and so on.

Really depends on what kind of field you're using, and whether or not you are running any other JavaScript.

replied on June 21, 2017

That is going to be really tricky. The database lookup are not instant, so you would need to attach events to one or more of the populated fields and evaluate their contents when they change.

Accomplishing the behavior you want is going to be relatively complex, and it can be unbelievably annoying for the user if you don't have the code absolutely perfect.

As far as just focusing on a specific field, you just need the following:

$('#YourField input').focus();

Just replace "YourField" with the id of your field (q2, q15, etc.). If you are using a multiline you would swap out "input" for "textarea" and so on. If you're working in tables, then it is a lot more complex but this post will give you an idea of how to identify/target table fields.

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

Sign in to reply to this post.