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

Question

Question

LF Forms: duplicate textbox input

asked on November 17, 2017

I have a form with five fields (Name, Title, Date, Name 2, Title 2). The Name2 and Title2 fields are read only and I would like to populate these to fields with the input entered in the Name and Title fields. I have created CSS classes for all  fields (Name1, Title1, Name2, Title2). I have the following code; however, I'm not having any luck.

 

 function populateFields() {
    var x = $('.patName1 input').val();
    var y = $('.DOB1 input').val();
    var z = $('.MRN1 input').val();
    $('.patName2 input').val(x);
    $('.DOB2 input').val(y);
    $('.MRN2 input').val(z);
  }

Capture.JPG
Capture.JPG (19.42 KB)
0 0

Answer

SELECTED ANSWER
replied on November 17, 2017

You can accomplish the same thing without JavaScript using calculations. Under advanced options for one of your read-only fields, you can insert "=VARIABLE" which will replicate the value of your target variable.

With JavaScript, though, you can pass values from one input to another like so:

$(document).ready(function(){
  $('.patName1 input').on('change', function () {
	$('.patName2 input').val($(this).val());
  })
});

 

2 0

Replies

replied on December 19, 2017

Did this work??? I have a similar issue.  

0 0
replied on December 19, 2017

Ramika,

In the example explained above, I enter the Name field variable (Name) in the Name 2: field Calculation (fx) section on the Advanced tab. This duplicated the input that was entered in the Name field into the Name 2: field.

Capture.JPG
Capture.JPG (47.17 KB)
0 0
replied on December 19, 2017

Which version of forms are you using?  9.2 or 10.x?

0 0
replied on December 19, 2017

Version 10.2.1.205

0 0
replied on December 20, 2017 Show version history

ok, currently i'm using 9.2x; maybe I can make it work after my upgrade to v 10.2x; thank you

0 0
replied on December 20, 2017

Once you upgrade, you'll be able to utilize this function. No prob.

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

Sign in to reply to this post.