Hi,
Is there any way to change the text of the textbox based on the selection of the dropdown?
thanks
Solved! Go to Solution.
Hi Divya,
I am O365 but it should be the same on Premises.
In my sample, I put in my text box the text value of my dropdown box.
In the setting of your dropdown box, give a name to Client ID JavaScript variable name: ddlContentType
In the setting of your text box, give a name to Client ID JavaScript variable name: txtAppendix
If you want that your text box is disabled, add this line NWF$('#' + txtAppendix).prop("readonly", true);
In Form Settings, under Custom Javascript,
NWF$(document).ready(function(){
NWF$('#' + txtAppendix).prop("readonly", true);
NWF$("#"+ddlContentType).change(function()
{
var selectedValue = NWF$('#' + ddlContentType + ' option:selected');
NWF$("#"+txtAppendix).val(selectedValue.text());
});
});
Hi Christophe,
I am looking at your solution and incorporating it for myself. In the line below, is the line added to the text box configuration or in Form Settings, under Custom JavaScript?
If you want that your text box is disabled, add this line NWF$('#' + txtAppendix).prop("readonly", true);
Thanks Christophe!
Divya,
Do you want that text box to still be editable after you have made the selection? If so, use Christophe's suggestion. If not, you can use a calculated value and bind that to your list column.
Cheers,
Chris
Hi,
Just want to say that these two options above are best options to use.
Hi, Divya Nair​, Let us know if either of those options proved helpful. Thanks!