Populate a choice field based off the value in another choice field.

  • 14 January 2020
  • 3 replies
  • 0 views

Badge +4

I am trying to make clothing order form. Shirts with different styles are available in different colors. What I want to do is when shirt style "X" is chosen i want my color options field to then display the colors that are available for that style. 

Below is my form and the code that I am trying to use to do this, I may be completely off with the code attempt, i was using another source as a reference to come up with this. Once I figure this out for once style I need to do this for 4 other styles and I'm not sure how to do that. 

6142i763F56FA0893B684.png

NWF.FormFiller.Events.RegisterAfterReady(function () { 
   NWF$('#'+varShirtStyle).change(function(){
     if (NWF$('#'+varShirtStyle + ' input:choice').val() == 'Instructor'){
        NWF$('#'+varShirtColor).val('Red');
     }
   })
})

 

 


3 replies

Badge +12

@gwpeters ....have you consider using a seperate list and using lookup controls create a cascading dropdowns?

Badge +4
I thought about that but figured there had to be a better way than that for this task.
Badge +4

I have decided to take a different approach to this, I will ask in a new post. 

Reply