Skip to main content
Nintex Community Menu Bar
Solved

Change CSS Value with Javascript IF List Variable is true

  • Nov 12, 2021 10:01 AM UTC
  • 3 replies
  • 93 views
  • Translate All

Hi Folks,

 

i have a css field in Nintex Form [Settings Formular > Userdefined CSS]

.hello { color: red }

 

Can i change it via Javascript [Settings Formular> Userdefined Javascript] when a List Variable is true ?

 

Like ... If List Variable "Sky" is true then change the css ".hello" to {color: blue}.

 

 

 

Best answer by allan

Absolutely.
The easiest way is to assign a JS variable to your control and use this :  

 

 

NWF.FormFiller.Events.RegisterAfterReady(function() { NWF$("#" + YourJSControlID).change(function(){ if(NWF$(this).val()=="Sky"){ NWF$(".hello").css("color","red"); } else { NWF$(".hello").css("color",""); } }); });

 

 

NWF.FormFiller.Events.RegisterAfterReady is the "$(document).ready" of Nintex Forms
YourJSControlID is the ID you put in "Store Client ID in JavaScript variable" of your control
Then you need to change the color depending of "Sky", but also remove the color if it is not "Sky".

 

View original

3 replies

allan
Nintex Partner
Forum|alt.badge.img+9
  • Nintex Partner
  • Answer
  • Nov 16, 2021 9:52 AM UTC

Absolutely.
The easiest way is to assign a JS variable to your control and use this :  

 

 

NWF.FormFiller.Events.RegisterAfterReady(function() { NWF$("#" + YourJSControlID).change(function(){ if(NWF$(this).val()=="Sky"){ NWF$(".hello").css("color","red"); } else { NWF$(".hello").css("color",""); } }); });

 

 

NWF.FormFiller.Events.RegisterAfterReady is the "$(document).ready" of Nintex Forms
YourJSControlID is the ID you put in "Store Client ID in JavaScript variable" of your control
Then you need to change the color depending of "Sky", but also remove the color if it is not "Sky".

 

Translate

  • Author
  • Nov 17, 2021 7:43 PM UTC
thanks !!!! much love !
Translate

  • Author
  • Nov 18, 2021 10:52 PM UTC

btw (i hope its just btw)

 

can i ask the value of a list variable instead a javascript id ? So i don´t really want to add a textfield or something with the javascript id ... he should ask the value in the element, not in the form... is that possible ?

like ... or it runs with a lookup ?

 

 

NWF.FormFiller.Events.RegisterAfterReady(function() {
NWF$("#" + ListVariable).change(function(){
if(NWF$(this).val()=="Sky"){
NWF$(".hello").css("color","blue");
} 
});
});

Translate