MarwenK
Novice

Why CheckBox fires change event after page init ?

Hi all

 

I have a onChange checkbox event that if checked stores currentUserName in a datalabel control there for is persisted on database when view executes update.

 

The problem is when I load the page it's not the user from db that is shown but the current user.

It means that the onChange checkbox event is fired on page load

 

I want to avoid firing the change event on the checkbox (by using on click event for example)

 

Any ideas please ?

 

4620iF4E066449445CC85.png

 

4622iF29EEAD90DFBC8E6.png

0 Kudos
Reply
4 Replies
AhmadAbdullah
Novice

Re: Why CheckBox fires change event after page init ?

Dear ,

 

If i understood u right , u have the same form for 2 scenarios used .

and u want the checkbox to behave differently in the 2nd scenario .

try using a flag variable on ur form , like a data label to have it as a flag to indicate which scenario u r on right now.

or check "form state" , and create 2 states each for the 2 scenarios u got .

 

Hope these ideas help ,

Regards.

0 Kudos
Reply
MarwenK
Novice

Re: Why CheckBox fires change event after page init ?

Hi Ahmad

 

i have only one scenario

 

Each checkbox is binded to a field from the SmO, the problem is when I load the page the name already loaded is replaced by the current user it means that the checkbox event is fired at page load

 

and when I disable the rule on the checkbox I dont have the issue but I dont have the fonctionnality wich is required

 

any ideas ? 

 

++

MK

0 Kudos
Reply
Olivier1
Novice

Re: Why CheckBox fires change event after page init ?

Hi Marouene,

 

I answered to the ticket

https://portal.k2.com/support/report/snapshotnew.aspx?ID=118461

 

with the following:

 

DIAGNOSIS:

It seems that the real issue is that we raise the "Change" event for the check-box in spite of we are in the "Initialize" or "Initialized" event (Load of data)

 

RESOLUTION:

We open 2 feature requests:

 

-  Don't raise the "Changed" events during the "Initialize" and "Initialized".
It will be more intuitive if we don't raise the event "Change" for all control if the data has been loaded during the event "Initialize" or "Initialized" is in progress.
This will avoid to put in place a workaround that use Data Label in order to detect the current status of the form ("Initialize" or "Initialized").

 

- After discussion with the colleagues and in order to keep the retro-compatibility, we think that the best solution is not follow the previous feature request "Don't raise the "Changed" events during the "Initialize" and "Initialized" because this modification could have an important impact on the existing K2 SmarForms project.
But an other feature request with less risk should be to have another new event "On User Change" (additionally to the "On Change") for all controls (Checkbox, Radio button, Textbox...).
It will be raise only by user change like Click or validate by the space key.

 

Olivier Chatagnon

0 Kudos
Reply
MarwenK
Novice

Re: Why CheckBox fires change event after page init ?

Hi Olivier,

thank you for your reply

 

Finally the solution came from our collegue. He proposed to execute a second read after loading but this time with getting only textbox values and not checkboxes

 

that will update the values from the database that have been changed by the changed event on the checkbox

 

0 Kudos
Reply