Re : Passing Checkbox values

Re : Passing Checkbox values

  
Hi All,

I have a tablerecords list with checkboxes that are used to toggle whether something is active or not.  The checkbox is linked to a local boolean variable.  Whenever the checkbox is clicked it is always returning a True value.  Which is causing my deactivation code to not trigger.

We recently upgraded to Service Center 5.0.2.23, prior to this we were on 4.2.4.33 and this functionality worked perfectly.

Any help is appreciated

Thank you,

James Teigen
Hi James,

can you attach an sample espace so someone can check the code?

RNA.
Hello,

I am attaching a small espace I put together that demonstrates the issues.

The checkbox is defaulted to True in this case, and unchecking the checkbox does not change the value.

Thank you,

James Teigen
Hi James, 

i've upgraded the espace and published for 5.1 and everytime i've clicked in the checkbox the expression value changed.

What browser are you using it?

RNA
I'm using IE 8, with service studio 5.0.2.23.  Unfortunately upgrading to 5.1 is not an option within my company.  I'll have to contact support as clicking the checkbox is always returning a true value.

I know this post is really old, but I ran into this same issue, and wanted to post a solution since one never was in this topic.

I had this exact issue when binding a checkbox widget to a session variable -- I could toggle the checkbox and the session variable simply would not change despite being bound to it's Variable property.

SOLUTION:

The checkbox's On Change > Destination was empty and this appears to cause the issue.  I make an empty action (just goes directly from Start to End) and set the checkbox's On Change > Destination to it and then the variable automatically updated when the checkbox was toggled.

Cheers!

Hi Jason,

In general, if you know a post is that old (over 7 years!) don't reply. Also, the original poster's problem was in a TableRecords, presumably because they bound a single local boolean to a TableRecords row; at least their example eSpace seems to work fine.

I cannot stress enough that having an On Change is not needed for a Check Box toggle to work.

Kilian Hekhuis wrote:

Hi Jason,

In general, if you know a post is that old (over 7 years!) don't reply. Also, the original poster's problem was in a TableRecords, presumably because they bound a single local boolean to a TableRecords row; at least their example eSpace seems to work fine.

I cannot stress enough that having an On Change is not needed for a Check Box toggle to work.


While I appreciate what you're saying, I'm afraid you're conceptually mistaken:

  • His issue was not with TableRecords, he was using checkboxes that just happened to be inside a TableRecords.
  • If you had actually looked at his espace you would realize that it doesn't have a TableRecords, it was just an empty page with a single textbox and a label (but still had the issue)
  • I am using version 10 and had the exact same issue: a variable not properly binding to a checkbox
  • This issue manifested itself the exact same way and is reproducible: it is the same bug that has survived for 7 years
  • I can reproduce the issue, so while I agree that it is not the intended behavior to require On Change, I am pointing out a bug where that is what happens in reality
  • It does not reproduce every time, so don't assume that because you don't see it that it doesn't happen on another system
  • I can also consistently solve the issue by adding an empty On Change, so I have posted the solution here should any other version 10 users run into this

Anyway, I completely agree that what you say would normally be true but this is a case where the same issue exists, and I thought I would resolve the original task since it is indexed higher in the search results and still relevant.  Cheers!

Jason Hamilton wrote:


  • I am using version 10 and had the exact same issue: a variable not properly binding to a checkbox
  • This issue manifested itself the exact same way and is reproducible: it is the same bug that has survived for 7 years
  • I can reproduce the issue, so while I agree that it is not the intended behavior to require On Change, I am pointing out a bug where that is what happens in reality
  • I can also consistently solve the issue by adding an empty On Change, so I have posted the solution here should any other version 10 users run into this

Hi Jason,

Could you provide an OML that reproduces this error you mention?
I would like to take a look, as I never run on it.

Cheers,
Eduardo Jauch


EDIT:
I'm asking because the example provided here (version 5), after upgraded to version 10 (latest one), works as it is expected.

Solution

Actually I don't consider this a bug... Session variables are stored in the server. If you bind a checkbox and not submit the form, the information is not updated in the server. That's the reason it works when you set the checkbox OnChange, since screenactions are Ajax.


Solution

Ah...

But André, this is not something specifically related to Session variables.
Anything you change Client side is available Server side only if you submit(ajax submit).

Is this what this is about?

In any case, the example provided here works, as the OnChange is used to refresh the expression, sending the actual value of the checkbox to the server. 

Cheers,
Eduardo Jauch

Aha, Andre is correct, it was from a session variable I was setting.  I don't mind calling it a non-obvious behavior instead.  Anyway, I didn't want to make too big a deal out of this, I just wanted to post a quick solution in case anyone else was banging their head against the wall with such a situation as I was.  

I'm very pleased with Outsystems so far (I'm an experienced developer, but new to Outsystems), and I thank you all for looking into this so quickly and actively. The behavior is now at least documented and searchable like I wanted. Cheers!