Canceling saving of an item via onBeforeSaveField function

More
13 years 2 weeks ago #25697 by ggppdk
mmm, we could do this:

1. If any onBeforeSaveField() call returns false then the declare the saving process as failed
2. Then the saving controller task, will call delete TASK for new items and restore version TASK for existing items


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
13 years 2 weeks ago #25709 by yaK2manD
Yes. It is exactly the wished behavior

Please Log in or Create an account to join the conversation.

More
13 years 2 weeks ago #25711 by ggppdk
I have opened a enhancement issue in bug tracker for this.

Currently, you should onBeforeSaveItem Event and examine the posted data that i proposed above, and thus stopping item changes before they happen.

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
13 years 1 day ago #26127 by ggppdk
This is a an interesting feature, but it was more tricky than i first thought


I have added this feature in r1348,r1349

If any FLEXIcontent field returns false IN ITS function onBeforeSaveField(...) then the item will not be created or altered

NOTE:
1. you must return false !!! not zero
e.g return (boolean) $counted_data;

2. The posted data of the new item or the changed data of the existing item are not reloaded YET !!! sorry did not have time for this


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
13 years 1 day ago #26135 by yaK2manD
Great news !!!

To me, it is the expected behavior ("wrong" data does not have to be reloaded)

Please Log in or Create an account to join the conversation.

More
13 years 1 day ago #26137 by ggppdk
Yes but you may have changed several fields before clicking save,

so it would make sense to load old form values just before clicking,

but this would be a little tricky to do for elements that have multiple values added via Javascript , nevertheless it is possible


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.363 seconds
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save