[TYPO3-project-formidable] Message after data have been saved in the DB
Luc Muller
l.mul-nospam-ler at ameos.com
Tue Jul 29 16:58:59 CEST 2008
Why don't you do this :
<renderlet:BOX mode="h4">
<html>
<userobj>
<php><![CDATA[/*<?*/
if($_SESSION["etat"] != ""){
$sMessage = $_SESSION["etat"];
unset($_SESSION["etat"]);
return $sMessage;
}
return false;
/*?>*/]]></php>
</userobj>
</html>
</renderlet:BOX>
Hope this helps
Luc =:0)
Izzie Greys a écrit :
> Hello,
>
> I'm still working on my messages. I think sessions could be great but I'm
> blocked.
> When the form is submit I save a variable in session and when I come back to
> the lister I display this variable.
> The problem is that the variable is always display after that. So I try
> this :
>
> The Box at the top of my lister which display my message or not :
> <renderlet:BOX mode="h4">
> <html>
> <userobj>
> <php><![CDATA[/*<?*/
> if ($_SESSION["display"]=="true"){
> $_SESSION["display"] = "false";
> return $_SESSION["etat"];
> }
> /*?>*/]]></php>
> </userobj>
> </html>
> </renderlet:BOX>
>
> And what I have done in <beforeinsertion> of my edit/create form:
> <beforeInsertion>
> <userobj>
> <php><![CDATA[/*<?*/
>
> ...
>
> if($this->oDataHandler->_creation()) {
> $_SESSION["etat"] = "user created";
> }
> else{
> $_SESSION["etat"] = "user edited";
> }
> $_SESSION["display"] = "true";
>
> ...
>
> /*?>*/]]></php>
> </userobj>
> </beforeInsertion>
>
> My problem is when I add this line $_SESSION["display"] = "false" in the
> "if" condition of my BOX the message is never display even after the
> $_SESSION["display"] = "true" in <beforeinsertion>. I really don't
> understand why ?? And if I delete the line $_SESSION["display"] = "false"
> the message is always display....
>
> Do you understand my problem ? If someone have a clue for this I would be
> grateful because I spent so much time on this problem I'm going to be crazy
> :)
>
> Bye
>
> 2008/7/11 Izzie Greys <izzie.greys at gmail.com>
>
>
>> It's just that I thought it would be easier to have the message and go
>> automatically on the list page after the click of the javascript alert.
>>
>> But it seems I can't do that kind of thing so I will try to do your method.
>>
>> Many thanks for your help Luc :)
>>
>> 2008/7/11 Luc Muller <l.mul-nospam-ler at ameos.com>:
>>
>>
>>> hmmm... that's a strange way to make such a thing.
>>>
>>> for your error, it's normal that you have a php error, as you"re writing
>>> some code in the page it cannot process the redirection
>>>
>>> but, the point that I do not understand is why do you use a javascript
>>> message ?
>>> if you're redirecting to say that data is saved is to redirect to a page
>>> where belongs a message that say the data are saved.
>>>
>>> there you can place a link back to the list
>>>
>>> Luc
>>> Izzie Greys a écrit :
>>>
>>>> Hi Luc,
>>>>
>>>> Thanks to you I solved my first problem :) Now if data are wrong I'm
>>>>
>> not
>>
>>>> redirected to the list. Thank you very much, it works fine.
>>>>
>>>> However I still have the second problem. I used this code in the php
>>>>
>>> section
>>>
>>>> :
>>>>
>>>> echo( "<script language=\"javascript\">alert(\"Data saved\");</script>"
>>>>
>>> );
>>>
>>>> It's ok the message is shown if data are good, but I have the
>>>>
>> javascript
>>
>>>> message, an error on the page and nothing else. I don't go back to the
>>>>
>>> list.
>>>
>>>> The error is :
>>>>
>>>> *"Warning*: Cannot modify header information - headers already sent by
>>>> (output started at
>>>>
>>>>
>> C:\wamp\www\typo3conf\ext\ameos_formidable\api\class.tx_ameosformidable.php(4986)
>>
>>>> : eval()'d code:4)
>>>>
>>>>
>> in*C:\wamp\www\typo3conf\ext\ameos_formidable\api\base\act_redct\api\class.tx_actredct.php
>>
>>>> * on line *44*
>>>>
>>>> I think it's because the code is not inserted in my main page but I
>>>>
>> don't
>>
>>>> know how to solve the problem.
>>>>
>>>> Have you any idea ?
>>>>
>>>> Thanks again
>>>>
>>>> Regards
>>>>
>>>> Izzie
>>>>
>>>>
>>>> 2008/7/9 Luc Muller <l.mul-nospam-ler at ameos.com>:
>>>>
>>>>
>>>>
>>>>> Hi Izzie
>>>>>
>>>>> You should have a look at actionlets
>>>>>
>>>>> those should be placed inside the <control> tag
>>>>>
>>>>> <actionlets> are process at the end of all the process this means
>>>>>
>> after
>>
>>>>> data are inserted in the DB
>>>>>
>>>>> you can either use :
>>>>> <actionlets>
>>>>> <actionlet:USEROBJ>
>>>>> <userobj>
>>>>> <php><![CDATA[/*<?php*/
>>>>> //here you can paste so code to do stuff after
>>>>> datas are inserted in DB
>>>>> // you can retrieve stored data using :
>>>>> $aData = $this->oDataHandler->getStoredData();
>>>>>
>>>>> return false;
>>>>>
>>>>> /*?>*/]]></php>
>>>>> </userobj>
>>>>> </actionlet:USEROBJ>
>>>>> <actionlet:REDIRECT>
>>>>> <pageid>
>>>>> here you can input directly a page id OR
>>>>> <userobj>
>>>>> <php><![CDATA[/*<?php*/
>>>>> // you can use an userobj to redirect to a
>>>>> more advanced url.
>>>>> return $this->cObj->typolink_URL(
>>>>> array(
>>>>> "parameter" => 1,
>>>>> "additionalParams" => "",
>>>>> "returnLast" => "url",
>>>>> "useCacheHash" => "1",
>>>>> )
>>>>> );
>>>>>
>>>>> /*?>*/]]></php>
>>>>> </userobj>
>>>>> </pageid>
>>>>> </actionlet:REDIRECT>
>>>>> </actionlets>
>>>>>
>>>>> Hope this helps
>>>>>
>>>>> Luc =:0)
>>>>>
>>>>> Izzie Greys a écrit :
>>>>>
>>>>>
>>>>>> <typo3-project-formidable at lists.netfielders.de>Hey,
>>>>>>
>>>>>> I'm trying to use a submit button on my edit/create users form with a
>>>>>> message "User saved" if the data are ok before return to my users
>>>>>>
>> list.
>>
>>>>> Here
>>>>>
>>>>>
>>>>>> it's what I have done :
>>>>>>
>>>>>> <renderlet:SUBMIT name="btn-save" label="Save">
>>>>>> <onclick runat="server">
>>>>>> <userobj>
>>>>>> <php><![CDATA[/*<?php*/
>>>>>> $sLink = $this->cObj->typolink_URL(
>>>>>> array(
>>>>>> "parameter" => 51,
>>>>>> "returnLast" => "url",
>>>>>> "useCacheHash" => "1",
>>>>>> )
>>>>>> );
>>>>>> return
>>>>>>
>>>>>>
>>>>> $this->sendToPage($this->toWebPath($sLink));
>>>>>
>>>>>
>>>>>> /*?>*/]]>
>>>>>> </php>
>>>>>> </userobj>
>>>>>> </onclick>
>>>>>> </renderlet:SUBMIT>
>>>>>>
>>>>>> I have 2 problems :
>>>>>> 1 - If the data are wrong, I can't see the error messages (from the
>>>>>> validators) because of the redirection.
>>>>>> 2 - I don't know how to add a message "User saved". I know how to
>>>>>>
>> make
>>
>>> a
>>>
>>>>>> confirm message yes/no after the click but not just an information
>>>>>>
>>>>>>
>>>>> message
>>>>>
>>>>>
>>>>>> about the good insertion in the database.
>>>>>>
>>>>>> Can you help me ?
>>>>>>
>>>>>> Thanks in advance.
>>>>>>
>>>>>> Best regards.
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>>
>>>>> *Luc Muller*
>>>>> /Web Developper/
>>>>> /Formidable - Rapid Application Developpement Framework for Typo3
>>>>> <http://formidable.typo3.ug>/
>>>>> /Typo3 Ameos <http://www.ameos.com>/
>>>>>
>>>>> _______________________________________________
>>>>> TYPO3-project-formidable mailing list
>>>>> TYPO3-project-formidable at lists.netfielders.de
>>>>>
>>>>>
>>>>>
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-formidable
>>
>>>>>
>>> --
>>>
>>> *Luc Muller*
>>> /Web Developper/
>>> /Formidable - Rapid Application Developpement Framework for Typo3
>>> <http://formidable.typo3.ug>/
>>> /Typo3 Ameos <http://www.ameos.com>/
>>>
>>> _______________________________________________
>>> TYPO3-project-formidable mailing list
>>> TYPO3-project-formidable at lists.netfielders.de
>>>
>>>
>>>
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-formidable
>>
>> _______________________________________________
>> TYPO3-project-formidable mailing list
>> TYPO3-project-formidable at lists.netfielders.de
>>
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-formidable
>>
>>
--
*Luc Muller*
/Web Developper/
/Formidable - Rapid Application Developpement Framework for Typo3
<http://formidable.typo3.ug>/
/Typo3 Ameos <http://www.ameos.com>/
More information about the TYPO3-project-formidable
mailing list