Comparaison de deux dates puis validation.

More
11 years 7 months ago #36298 by seabird
Bonjour,

J'ai un article avec deux champs dates (date_debut et date_fin).
J'ai fait un plugin onAfterSaveItem afin que date_debut et date_fin paramètrent le début de publication et la fin de publication de l'article.

Avant d'enregistrer l'article, je compare également mes deux dates (en utilisant onBeforeSaveItem) pour être sur que date_debut soit inférieur à date_fin, sinon on reste sur le formulaire .
Jusque là pas de problème cela fonctionne.

J'ai juste un petit souci. Comment rester sur le formulaire si date_debut > date_fin. J'avais pensé à header('location:url formulaire');
Mais il y a peut-être une autre solution ?

Merci .

Eric

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

More
11 years 7 months ago #36300 by ggppdk
No, you should use:
Code:
if( $date_debut > $date_fin ) { echo "<script>alert ('Please enter correct dates , bla bla bla ...');"; echo "window.history.back();"; echo "</script>"; jexit(); }
This way the user -NEWLY- entered data will not be lost , and user will not have to retype them

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
11 years 6 months ago #36320 by seabird
Thanks the plugin works correctly.

Eric

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

More
11 years 6 months ago #36325 by micker
pense à partager cela pourrait être intéressant pour la communauté
Merci

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

More
11 years 6 months ago #36326 by seabird
Oui oui c'est prévu. Je fais un peu le ménage dans le plugin. J'envois ca cet aprem

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

More
11 years 6 months ago #36328 by micker
cool merci

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.378 seconds
Save
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