Hi ,
In
the properties of the Yes/No control, you'll need to specify a Client ID
Javascript variable name (in the Advanced section).
Next,
wherever you are checking the value, you can do it as follows, assuming the
Client ID was set to control1
NWF$(document).ready(function
() {
var
D6check = NWF$("#" + control1);
if
(D6check.prop("checked"))
{
alert('it
is checked');
}
else
{
alert('not
checked');
}
});
Note
this example is provided "as is" - you may need to make changes to it
so that it functions according to your business logic.
If
you want this code to run on form load, it needs to be inside the document
ready.
NWF$(document).ready(function
() {});
Kind
regards,
Nick Temelkovski |
![]()
-------------------------------------------------------------------------------------
And my main
question is, how can I read the input of a yes/no checkbox? So “alert(D6check);” would give me the answer yes/no or true/false or 1/0 or
something else. Because I want to use it for: if(D6check == true) {…}
Look here,
I tried a lot:
var D6check = NWF$(NWF$(D6).find("input:checked")).val();
var D6check = NWF$('#' + D6).val();
// = "on"
var D6check = document.getElementById("D6");
// = "null"
var D6check = NWF$('#' + D6).find("input:checked");
var D6check = NWF$('#' + D6).find("input:checked").val();
var D6check = NWF$(".D6 input:checked").val();
var D6check = argument3.Value;
var D6check = D6.IsValid;
var D6check = item[D6] as Boolean?;
Information:
Control
Settings - Yes/No
Name: D6
Connected to: D6
Store Client ID in JavaScript variable
: Yes
Client ID JavaScript variable name: D6
But nothing
works… can you help me please?
Thank you!
Kind
regards