Canceling saving of an item via onBeforeSaveField function

More
13 years 1 month ago #25280 by yaK2manD
It would be too simple ;)

The video could be a youtube video, or dailymotion, or ...

I have to execute a script in order to get all the video's information and fill other fields (extract the title to name the article, ...)

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

More
13 years 1 month ago #25307 by yaK2manD
I will use :

micker wrote: its simply create a texte field allow plugin to insert video example jw video
and use {youtube}prefix and {/youtube} suffix
extensions.joomla.org/extensions ... allery/812
regards


with a field own-made.

But I would like to know if it is possible to fill a field through another ?
Maybe in the form ?

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

More
13 years 1 month ago #25312 by ggppdk
Check this FAQ article, but note it is meant for developers:

Creating relation between fields:
www.flexicontent.org/documentati ... ields.html

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 2 weeks ago #25649 by yaK2manD
Hi,

I have a problem with the BeforeSaveField.
How can I do in order to avoid saving article if my test failed ?

Because I have just a warning but article still saved.

I used :

ggppdk wrote: To pass an error notice to the frontend you could use:

Code:
if ($ihavefailed) { $jAp=& JFactory::getApplication(); $jAp->enqueueMessage("my error message", 'notice'); }



Thank you.

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

More
13 years 2 weeks ago #25655 by ggppdk
Saving fields is performed after item is saved so you can not cancel item saving inside this function by e.g. setting a message (with enqueueMessage) and then redirecting to some page e.g. refer (previous page)


We have another event that is triggered before saving item:
onBeforeSaveItem

and use inside a plugin of TYPE system or flexicontent:
Code:
function onBeforeSaveItem( & $item, $isnew ) { $post = JRequest::get('post'); //echo "<pre>"; $post; echo "</pre>"; exit; //$somethingbad = ... if ($somethingbad) { $app = &JFactory::getApplication(); $app->enqueueMessage( 'Some error detected', 'notice' ); return false; } return true; }


Also in backend items.php controller a fix for redirection after error during item saving:
replace:
Code:
$msg = ''; $link = 'index.php?option=com_flexicontent&view=item';
with
Code:
$msg = ''; $ctrl_task = FLEXI_J16GE ? 'task=items.edit' : 'controller=items&task=edit'; $link = 'index.php?option=com_flexicontent&'.$ctrl_task.'&cid='.(int) $model->get('id');

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 2 weeks ago #25656 by yaK2manD
Thank you.

I have a last query :
In OnBeforeSaveField, I would like to delete entirely the item saved before.
Can I get the item id related to the field with $model->get('id') ?

Is there a way to delete (e.g. a function) an item properly ?



Thank you.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.345 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