How to change text field size by drop-down list value

eugzl 13-09-2019

Hi All.

I have drop-down list and text field in the form and Iwould like to change high and width by selecting value in drop-down list. If that is possible how to do that?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Arun_Patidar
MVP
14-09-2019

Hi,

you can get value from dropdown and applied to text field.

(function(document, $) {

    "use strict";

$(document).on("selected", "#dropdownId", function(e) {

    var selectVal = $(this).val();

    $("#textFieldId").attr("size", selectVal);

  });

})(document, Granite.$);

Answers (2)

Answers (2)

eugzl 14-09-2019

Hi Bharath. Thanks for replay.

Yes, I need JS code in event change of drop-down list with IF statement. It should be look like:

if(xfa.event.newText == "Other")

   TextField.presence.w = "2 in";

   DropDownList.w = "1 in";

else

   TextField.presence.w = "1 in";

   DropDownList,w = "2 in";

But that code doesn't work. My problem how correct to specify width in the JS code. How to fix it?

Thanks.