Skip to main content

Hi


I am working on Nintex form. I have a Yes/No control  which depending on another field either gets selected or not.


I have used NWF$("#" + JSControl).attr("disabled", "disabled"); but when the form is submitted the value is not saved.


 


I have tried to use both the following :


 


NWF$('#' + JSControl).prop("readonly",true);


NWF$('#' + JSControl).attr('readonly',true);


 


which does not work on the Yes/No control but have tested it and works on text form box is there somthing l am missing for a Yes/No control.


 


I have even tried to put the Yes/No control into a panel and applied the rule to that also same issue when l submit the form the value is missing.


 


Any help would be greatly appreciated 

Maybe this thread helps you; https://community.nintex.com/t5/Nintex-for-SharePoint/Set-Checkboxes-to-Yes-based-on-two-conditions/m-p/71561#M59142

NWF$('#' + JSControl).prop('checked',true);

Sorry the issue is not with making the Yes/No control but when the form gets saved the values are not getting saved back the sharepoint list so the values are being lost. 


Just a quick check, you are using Nintex Forms 2013 with Classic Forms, right? I just did a quick test with a button that checks a simple Yes/No checkbox. The button executes the following function:

function CheckBox {
NWF$('#' + SimpleCheckBox).prop('checked',true);
}

I added a CSS-class to the 'Save and submit'-button, which enables me to submit the form through the function.

function CheckBox {
NWF$('#' + SimpleCheckBox).prop('checked',true);
NWF$('.SubmitCSSClass' input').click();
}

Can you share your full JavaScript so we can take a look at it?

Hi Please see below :


 


Yes Nintex form 2013 , Classic forms


 


NWF$('#'+DropdownJS).change(function() {
var VarDropdownJS = NWF$('#'+DropdownJS).find("option:selected").text();
//Gets the value from the Client ID JavaScript variable name DropdownJS puts in into a variable 



if (VarDropdownJS!=("Please select a value...")
{
NWF$('#'+FreeFormJS).prop('checked',false);

NWF$('#'+FreeFormJS).val(VarDropdownJS);
}

else if (VarDropdownJS == "Business Company") {

NWF$("#" + YesNoJS).prop('checked',true);
NWF$("#" + YesNoJS).attr("disabled", "disabled"); } ##Issue is here l want to disable the Yes/No control if the dropdown is "Business Company" but when l submit the form the value does not save back to the sharepoint list its empty l have tried to use NWF$('#' + YesNoJS).prop("readonly",true); and NWF$('#' + YesNoJS).attr('readonly',true); but the Yes/No control is still changable.


 


Hope that clarifies things sorry if no


I would suggest to just use the JavaScript to (un)check the Yes/No button, but use a rule to Disable the Checkbox when the Dropdown equals 'Business Company'. That should work!

Thanks for your reply , that is the first way l tried but the rule was not applying so went with javascript


 


I added a rule to the Yes/No control marked as disable with the following condition :


 


YesNoNamedControlName == "Business Company"


 


but that had no affect on the Yes/No control


I have added a screenshot that worked for me. I used the JavaScript as mentioned earlier to check the Yes/No box, but used the rule as shown in the image to disable it when the drop down value is 'Business Company'.


 


The rule is, as you can see, added to the 'Checkbox'. It checks the Drop Down value and, if that is 'Business Company', it disables the checkbox.


 


 


Yes did the same but not working for me.


Must be some other underlining issue with Nintex forms on my machine.


Thanks for your time.


Must be something to do with the Yes/No control


 


As both of the following :


 


NWF$('#' + JSControl).prop("readonly",true);


NWF$('#' + JSControl).attr('readonly',true);


 


work on free form control and the disable rule also works on a free form control.


This something about Yes/No control that noting works on it. I have tried to delete the control and re-create it same issue


@JohnSmith - Maybe you already changed this part of your script, but you are missing a ')' in the first if-statement (or you remove them since they are not needed necessarily);


 


NWF$('#'+DropdownJS).change(function() {


var VarDropdownJS = NWF$('#'+DropdownJS).find("option:selected").text();


 


if (VarDropdownJS!=("Please select a value..."))


{
     NWF$('#'+FreeFormJS).prop('checked',false);
     NWF$('#'+FreeFormJS).val(VarDropdownJS);
}
else if (VarDropdownJS == "Business Company")


{
    NWF$("#" + YesNoJS).prop('checked',true);
}
}


Yes that was typo is correct on the form 😉

After some investigation l think l know where the issue is with the formatting rules not working.


 


As the condition l am using is :


 


equals(SingleLinecontrol, "Business Company")


 


The value in the Single Line textbox control is populated via javascript reason when l use "Business Company" it is not registering the value. Do l need to do something with the value to make sure it in a literal string or something for the formatting rule to pick up the value ?


You need to 'trigger' the form to adjust with the change. The following piece of code works to update a single line of text through JavaScript, and trigger the configured rule with the same condition you mentioned earlier.

function updateValue() {
NWF$('#' + SingleLineTXT).val("Business Company");
NWF$('#' + SingleLineTXT).trigger('blur');
}
Thanks that worked.

Reply