Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Silly checkbox

Pulling my hair out trying to use Custom JS to check a checkbox...

Jquery docs examples dont work...
These also, no go.
$('[dsid="checkbox1"]').prop("checked", true).checkboxradio("refresh");
$('[dsid="checkbox1"]').attr("checked",true);

This works but have many boxes to deal with...
$("input[type='checkbox1']:first").attr("checked",true).checkboxradio("refresh");

How do I select it and check or uncheck it?
And test if checked...

Please help...

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Silly checkbox

Hello Neil! Could you share your App or tell us it's name if App shared already?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Silly checkbox

Hello! Please try this:

Tiggzi("mobilecheckbox1").find("input[type='checkbox']").attr("checked",true).checkboxradio("refresh");

Tiggzi("mobilecheckbox1").find("input[type='checkbox']").attr("checked",false).checkboxradio("refresh");

I tested this on Button click - it works

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Silly checkbox

Freaking awesome Marina !!!
Thank You !

Tiggzi("mycheckbox").find("input[type='checkbox']").attr("checked",true).checkboxradio("refresh");
Works Perfect !
And Use code below to test if checked...
code
var test1 = Tiggzi("checkbox1").find("input[type='checkbox']").attr("checked");
if (test1 == "checked"){
alert ("true");
}else{
alert ("false");
}
/code

I just noticed...
If I use the code u gave to check the box . My code to test box does not work.
If I manualy check the box it does...

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Silly checkbox

So how do I test if checked when I us JS to check it. When the the user clicks the check box to uncheck.??

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Silly checkbox

Check what you get in 'test1'.

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Silly checkbox

When using the JS function I get "checked" for box checked "undefined" for not checked.
If using JS to check box. Then Manually uncheck box... test1 still shows "checked".

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Silly checkbox

I'd recommend to check jQuery docs, or examples how to do that.

Emmz
Posts: 0
Joined: Sat Jun 23, 2012 11:06 pm

Silly checkbox

For folks later
My work around...
placed Tizzgi Panel.
put in.. code<label><input type="checkbox" name="testbox1" id="testbox1" &#47;>test box <&#47;label> /code

To check the box using custom JS.
$('input[name=testbox1]').attr('checked', true).checkboxradio("refresh");
Uncheck it..
$('input[name=testbox1]').attr('checked', false).checkboxradio("refresh");

to test if checked...
code
var test1 = $('input[name=testbox1]')&#46;is(':checked')
if (test1 == true){
alert ("true" + test1);&#47;&#47; returns true
}else{
alert ("false" + test1);&#47;&#47;returns false
}
/code
Now even when u use custom JS to make checkbox checked. And the user unchecks the box after. The test if checked returns false like it should.

Mark6921260
Posts: 0
Joined: Mon Jun 09, 2014 3:35 pm

Silly checkbox

I have tried this above and my checkbox doesn't change. Originally the checkbox is set to Selected but if someone wants to opt out they can unclick it. However I need to reset it to Selected for the next person and it is currently not doing that.
Here is what I have:

I am trying to change this checkbox from 'not checked' to 'checked' when I click on the Clear button.
Image

So I've added the following code to the Clear button's Click event. I've three different solutions I have found in the Appery.io forum but none of them work.

Image

Last here is an image showing the name of the check box:
Image

Thank you

Return to “Issues”