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 ?
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 ,
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 ?
I answered to the ticket
with the following:
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)
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.
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