Page 1 of 3

checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 7:34 am
by w

Reposting here, because my last question was set as "answered", while it didn't answer what I needed.

Can somebody explain me clearly how to address checkboxes in Tiggzi, and what is the programmatic difference between the checkbox group and the checkbox item?

Especially with for example 1 checkbox, Tiggzi creates a checkbox group and a checkbox item.
On which elements do I have to call the methods? For example checkboxradio('refresh')? It seems to be different for val(), is(:checked), prop('checked')? And what about trigger('change') , this is all giving mixed results if applied to the checkbox group or the checkbox item.

1) If I use the checkbox "value change" event, this event is fired 2 times when I click the single checkbox. Is this standard behaviour?

2) Also, when checking the state of the checkbox in javascript, it is not working:

Tiggzi('chkItemFavoriet').prop('checked') gives UNDEFINED

and $('input[name="chkItemFavoriet"]').is(':checked') gives FALSE

my checkbox is named 'chkItemFavoriet'

3) This is what happens if I do the checking on the name of the control GROUP I defined in Tiggzi instead of the name of the checkbox item:

Tiggzi('chkFavoriet').prop('checked') : UNDEFINED $('input[name="chkFavoriet"]').is(':checked')): TRUE

Somebody agrees that this is inconsistent or strange behaviour?

That's why I was asking what Tiggzi is doing with the control group and individual checkboxes, from a programmatic point of view, because the checkbox checking and setting is unpredictable.


checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 7:44 am
by w

When I check in the value change event of the checkbox item itself:

$(this).prop('checked') is giving the CORRECT state of the checkbox. So there it is working.


checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 7:47 am
by w

I rechecked point 1 that I made in the 1st post, with a complete new page without dependencies, added a checkbox. And the value change event is effectively called 2 times. Is this the expected behaviour? Because it is something important to take into account.


checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 8:06 am
by w

I checked by creating a complete new app in Appery:

  • I create 1 checkbox: I name the group 'chkGroup' and the item 'chkItem'

    When I check the state with alert(Appery('chkGroup').prop('checked')); or with alert(Appery('chkItem').prop('checked')); I get

    all the time UNDEFINED.

    Please help...


checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 8:07 am
by Kateryna Grynko

Hi,

I'll take a look and update.


checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 8:32 am
by w

Can you also check this? : New project, 1 checkbox (controlgroup name is chkGroup, and the checkbox item name is chkItem) and 1 button.

In the click event of the button: Appery('chkItem').prop('checked', true).checkboxradio('refresh').trigger('change');

This gives me a " Error: cannot call methods on checkboxradio prior to initialization; attempted to call method 'refresh' @ http://appery.io/app/resources/previe..." in Firebug.

How can the checkboxradio not be initialized when it's a static checkbox, that is not dynamically created, and the click event is called after the page has long been loaded?


checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 8:41 am
by w

It is really strange. Another checkbox that was working until this week with the same methods, is not working anymore.

Did firefox update something that has broken the jquery checkbox functionality?

EDIT: same problems in IE10


checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 9:19 am
by w

Think I get a sense of why all this is so confusing. So in the Appery UI i created 1 checkbox. I named the group 'chkGroup' and the checkbox item 'chkItem'

This is the HTML created by Tiggzi:

precode<div data-role="fieldcontain" class=" mobilecheckboxgroup1" id="j_5" dsid="chkGroup">
<fieldset data-role="controlgroup">
<span dsid="chkItem" class="mobilecheckbox1">
<input type="checkbox" name="chkGroup" id="j_6" tabIndex="2" data-theme="a" value="Item 1"
&#47;>
<label id="j_6_label" for="j_6">
Item 1
<&#47;label>
<&#47;span>
/code/pre

So to summarize, this is what Appery makes from it:

chkGroup: is a div with dsid="chkGroup", containing the checkbox group.
But it is also the name of the html input itself!!
chkItem : is a span with dsid="chkItem"

So when I do Appery('chkGroup') , this is referring to every input checkbox of the group. When i do Appery('chkItem'), this is referring to a span

This is not the behaviour that i expected. I expected that I could address the individual checkbox with Appery('chkItem').

So the question: how to select 1 particular checkbox?

And what about the error" Error: cannot call methods on checkboxradio prior to initialization; " that I talked about 2 posts above?


checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 9:48 am
by w

In Tiggzi it's even different:

precode<fieldset data-mini="true" data-role="controlgroup" class="ui-corner-all ui-controlgroup ui-controlgroup-vertical ui-mini"><div class="ui-controlgroup-controls">
<span class="mobilecheckbox2" dsid="chkItem">
<div class="ui-checkbox"><
input type="checkbox" value="Item 1" data-theme="b" tabindex="4" checked="checked" id="j_168" name="chkGroup">
&#46;&#46;&#46;

Code: Select all

                                         <&#47;span> 

                                     <&#47;div><&#47;fieldset>/code/pre

checkbox group and checkbox item behaviour

Posted: Tue May 14, 2013 10:58 am
by w

Any update on this please? I already lost my entire morning due to this, I would like to do something productive in the afternoon.