Hi everyone,

I have used redirect a thousand times successfully. but this one is
weird.
This is my process. User wants to save his data and the system checks
if all necessary field are filled out. if so, save the data. if not,
give an JS-alert.

the whole thing works. the alert when data is missing
and
the saving when the form is complete. cake just wont redirect after
saving. here is my code:


the trigger in my view (the button)
========================

echo '<div class="small_button" onclick="save()"
style="float:left;cursor:pointer;">'."Save".'</div>';


javascript function in my view:
========================

function save()
{
        var title_content = $('#TitlePopup').val();


        if (!title_content)
                $.pnotify({     pnotify_title: 'Missing Fields.', pnotify_text: 
'Please
fill out all fields.'});
        else
                $.post(installFolder + 'books/save', {});

}


books_controller:
========================

function save()
{

...some code here for saving the data....

$this->Session->setFlash('saving successful');
$this->redirect(array('controller' => 'books', 'action' => 'view',
$id));


}


the redirect works(!) when i call the controllers save() function
directly like:
echo $html->link('Save', '/books/save',
array('class'=>'small_button'));


is this some technology thing with no workaround possible? like JS and
cakePHP wont work together in this case? or am i missing some
fundamentals here?


appreciate your help :)

thanks!!



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to