Skip to main content

I currently have a form where users must enter a disk id number. The next field is a drop down with a list of server names. The disk numbers start with 1-7. If the disk starts with a 1, it came from server 1, if a 2, it came from server 2 and so on. How do I make the disk id automatically trigger the correct server name in the drop down list? Thanks in advance!

If 'Disk id Number' is a 'Single line of Text' then try this JavaScript code.

NWF$(document).ready(function()
{  
NWF$('#'+ txtDiskNo).bind('input',function(){ 
               fnSetServerName();
    });
});
function fnSetServerName()
{
 var disk = NWF$('#'+ txtDiskNo).val();
 
 if(disk == 1)
 {
  NWF$('#'+ddlServer).val('Server1');
 }
 else if(disk == 2)
 {
  NWF$('#'+ddlServer).val('Server2');
 }
 else
 {
  NWF$('#'+ddlServer).val(' ');
 }
}

  


Thank you Lakshmi. I'm guessing I insert the code in Form Settings under Custom JavaScript


Not sure if this a prodction form yet or not, but one thing you could do if you didn't want to have JS in your form, is look at the new responsive forms. You can now set a rule for example:

Rule Name: Set Server to 1

When: startsWith("NamedControl Name", "1") == true

Then: Set Value

Named Control  = value you want to set

Only thing you would have to redo your form because you have to choose pixel perfect vs responsive. Good news is it takes 1/4 the time to create the responsive forms than the pixel perfect forms.


matt bonner‌ have you resolved your issue? Is any from the above answers helpful thus you could mark it as "correct"?

Regards,

Tomasz


Reply