Page 1 of 1

Retrieve Checkbox state from Hash Cookie

Posted: Tue Aug 18, 2020 4:26 am
by kev1n
Hi,

Calling

Code: Select all

nuDebug(nuHash()); 
in BS, AS etc.

always shows empty values for Checkboxes, even if their state is checked.

One would expect true, false values instead.

Code: Select all

[0] : Array
( 
...
    [exp_table_data] => 
    [exp_run_objects] => 
    [exp_change_pk] => 
    [exp_skip_comments] => 
...
)

Re: Retrieve Checkbox state from Hash Cookie

Posted: Tue Aug 18, 2020 4:30 am
by kev1n
My workaround is to set new Hash Cookies with 0/1 values for each checkbox in nuBeforeSave()

Code: Select all

    $('input[type=checkbox]').each(function () {
          nuSetProperty(this.id + '_checked', this.checked ? '1' : '0');     
});

Re: Retrieve Checkbox state from Hash Cookie

Posted: Tue Aug 18, 2020 5:54 am
by admin
kev1n,

It seems to work for me.
aaa.png

Steven

Re: Retrieve Checkbox state from Hash Cookie

Posted: Tue Aug 18, 2020 3:04 pm
by kev1n
Hi Steven,

I'm afraid I wasn't specific enough. The checked status can only not be retrieved when a Procedure is called (but it works fine with BS, AS etc. as you wrote)

A form contains a Checkbox with Object ID: "exp_skip_comments"

In the form's custom code, run

Code: Select all

nuRunPHPHidden('my_procedure', 0);
In the Procedure, output the variable:
nuDebug("#exp_skip_comments#");
Result:

Code: Select all

[0] : 
or with

Code: Select all

nuDebug(nuHash());
Result:

Code: Select all

[exp_skip_comments] => 

Re: Retrieve Checkbox state from Hash Cookie

Posted: Thu Aug 20, 2020 8:33 am
by admin
kev1n,

I believe that is now fixed on Github.


Please test it.


Steven

Re: Retrieve Checkbox state from Hash Cookie

Posted: Thu Aug 20, 2020 10:49 am
by kev1n
Perfect - thanks!

Re: Retrieve Checkbox state from Hash Cookie

Posted: Thu Aug 20, 2020 11:50 pm
by admin
.