Skip to main content

I have two choice fields as mentioned in below screen shot:

195881_pastedImage_1.png

and the requirements is:

    If Original PO available then Source of Order field should contain string as "Not Applicable" and it should be disabled.

I used rules to disable Source of Order if Original PO available is "Yes", but not able to set value for Source of Order as "Not Applicable"

Can any body help? ....

Thank

Sunil

to set value of choice control based on value/change of other choice control you will have to write javascript code.

assign javascript variable to your choice controls, eg. varOriginalPOAvailable and varSourceOfPO.

then code like this should do the job.

NWF.FormFiller.Events.RegisterAfterReady(function () { 
   NWF$('#'+varOriginalPOAvailable).change(function(){
     if (NWF$('#'+varOriginalPOAvailable + ' input:checked').val() == 'YES'){
        NWF$('#'+varSourceOfPO).val('Not Applicable');
     }
   })
})

Thanks Marian for your quick response.  Will you kindly explain me in brief how and where this can be set.

Thanks

Sunil


you have to set javascript variables in control's setting dialog

javascript copy&paste into form settings/custom javascript


Thanks Marian,

As guided copied javascript after making small changes like "YES" changed to "Yes" and putting semicolons for last two parentheses. also copied variables (varOriginalPOAvailable, varSourceOfPO) to the respective controls.  The script runs but the string "Not Applicable" does not appear in Source of Order, instead the field gets blank on selecting Yes for Original PO Available.

195958_pastedImage_1.png

Thanks

Sunil


can you post what's the content of  'source of order' dropdown? is 'Not applicable' option listed there?

can you try to deactivate formatting rule that disables the control?


Great.  

'Not Applicable' was not listed in option.  Listed the same in option and now it shows perfectly, also deactivation also work.

195966_pastedImage_1.png

Thanks a lot.

Cheers happy.png

Sunil


What if OrigionalPOAvailable was a dropdown selection insead of a check box. Would you have to change "input:checked" to something else? and if so, what?

I have a similar need and believe this could be the solution. Currently, it isn't working.

I've assigned my variables on each field, and tweaked this JS in my form settings to reflect my variables and data. I'm thinking the problem is that I'm setting a checkbox choice field that allows multiple selections from a dropdown choice selection.

Thanks

Kassie


edit:

I kind of figured it out. I just left the whole "input:checked' portion off the script.

 NWF.FormFiller.Events.RegisterAfterReady(function () {
   NWF$('#'+varBusRole).change(function(){
     if (NWF$('#'+varBusRole).val ("Yes")){
        NWF$('#'+varEnvi) .val ("Both");
     }
   });
});

Now I'm wondering how I can update multiple field values , not just "varEnvi" My change is in bold below. It isn't working.

 NWF.FormFiller.Events.RegisterAfterReady(function () {
   NWF$('#'+varBusRole).change(function(){
     if (NWF$('#'+varBusRole).val ("Yes")){
        NWF$('#'+varEnvi) .val ("Both")

        NWF$('#'+varSystem) .val ("All");
     }
   });
});


What if OrigionalPOAvailable was a dropdown selection insead of a check box.

dropdown for choice or lookup?

scripting for the two will be different.

  if (NWF$('#'+varBusRole).val ("Yes")){

likely, this statement is not correct:  expression NWF$('#'+varBusRole).val ("Yes") sets the value of the NWF$('#'+varBusRole) control, not checks its value being "Yes".

result of assignment is object being modified, so it's always evaluated to boolean true.

My change is in bold below. It isn't working.

as mentioned above, it may depend on type of control

I'd suggest to start new question since this seems to going  to different direction as original question...


Thanks for the reply Marian, I did make a new thread. here's the link:

https://community.nintex.com/thread/19971-set-multiple-field-values-based-on-other-field-selection

Thanks happy.png

Kassie


Reply