I'm sorry if this sounds too obvious, but there has to be some
response (maybe it is an error or not); in your controller you have:
echo "made it!", where do you expect to see this? use firebug to see
the ajax request and the response and also the posted data. Also, if
you just want to update the database and not to render a view add:
$this->autoRender=false to saveOrder.
On Mar 29, 5:43 pm, "Dustin" <[EMAIL PROTECTED]> wrote:
> According the Live HTTP Headers (application to check headers), the
> ajax request is being made, but there doesn't seem to be a response
> from the saveOrder action. Is there some sort of code to hand the
> ajax request that needs to be in the saveOrder action?
>
> Thanks,
>
> Dustin Weber
>
> On Mar 29, 11:44 am, "bernardo" <[EMAIL PROTECTED]> wrote:
>
> > Your code looks ok to me now. Have you checked with firebug that the
> > ajax request isn't made?
>
> > On Mar 29, 1:13 pm, "Dustin" <[EMAIL PROTECTED]> wrote:
>
> > > Bernardo,
>
> > > That made no difference. The drag n' drop stuff graphically works,
> > > but it isn't contacting my saveOrder action in my controller. I feel
> > > like I'm missing a bit of code somewhere that is the proverbial
> > > "missing link". Do I need something in my controller action saveOrder
> > > for it to know to expect Ajax calls?
>
> > > The view now looks like this:
>
> > > Order View:
> > > --------------------------------------------------------------------------------------------------------
> > > <?php
> > > if (isset($javascript)):
> > > echo $javascript->link('scriptaculous/lib/prototype.js');
> > > echo $javascript->link('scriptaculous/src/scriptaculous.js');
> > > endif;
> > > ?>
> > > <ul id="questions">
> > > <?php foreach ($faqs as $faq): ?>
> > > <?php echo "<li id=\"question_" . $faq['Faq']['id'] .
> > > "\">" . $faq['Faq']['question'] . "</li>"; ?>
> > > <?php endforeach; ?>
> > > </ul>
> > > <?php echo $ajax->sortable('questions', array('url' =>
> > > 'saveOrder')); ?
> > > <p>
> > > <input type="button" value="Cancel"
> > > onClick="window.location='../faqs';" />
> > > </p>
> > > ----------------------------------------------------------------------------------------------------------------
>
> > > Dustin Weberhttp://www.dustinweber.com
>
> > > On Mar 29, 10:43 am, "bernardo" <[EMAIL PROTECTED]> wrote:
>
> > > > Try setting the id of the li to something like faq_1 faq_2 ... that is
> > > > they should end in an underscore and a number.
>
> > > > On Mar 29, 11:41 am, "Dustin" <[EMAIL PROTECTED]> wrote:
>
> > > > > I did my very best to search everywhere I could to solve this problem
> > > > > related to the $ajax->sortable helper. Most of the posts are dated,
> > > > > so I apologize if I missed the answer somewhere else.
>
> > > > > Here's what I have:
>
> > > > > Controller snippets (related to this question):
> > > > > -------------------------------------------------------------------------------------------------------
> > > > > var $helpers = array('html', 'time', 'javascript', 'ajax');
>
> > > > > function saveOrder()
> > > > > {
> > > > > echo "made it!"; //just to check and see that it made it for
> > > > > now
> > > > > //normally we would do some DB updating here instead
> > > > > }
> > > > > --------------------------------------------------------------------------------------------------------
> > > > > *all my other actions work properly in this controller
>
> > > > > Order View:
> > > > > --------------------------------------------------------------------------------------------------------
> > > > > <?php
> > > > > if (isset($javascript)):
> > > > > echo $javascript->link('scriptaculous/lib/prototype.js');
> > > > > echo $javascript->link('scriptaculous/src/scriptaculous.js');
> > > > > endif;
> > > > > ?>
>
> > > > > <ul id="questions">
> > > > > <?php foreach ($faqs as $faq): ?>
> > > > > <?php echo "<li id=\"" . $faq['Faq']['id'] . "\"
> > > > > style=\"margin:
> > > > > 5px; padding: 5px 5px; border: 1px solid #000; width: 500px; cursor:
> > > > > pointer;\">" . $faq['Faq']['question'] . "</li>"; ?>
> > > > > <?php endforeach; ?>
> > > > > </ul>
>
> > > > > <?php echo $ajax->sortable('questions', array('url' => 'saveOrder'));
> > > > > ?
>
> > > > > <p>
> > > > > <input type="button" value="Cancel"
> > > > > onClick="window.location='../faqs';" />
> > > > > </p>
> > > > > ----------------------------------------------------------------------------------------------------------------
>
> > > > > Using just those two simple snippets, I get the sortable list
> > > > > graphically working in the view. In simple terms, I can drag the
> > > > > boxes around with no problem. However, the sortable helper isn't
> > > > > doing anything. The controller action "saveOrder" never get's called
> > > > > by the helper.
>
> > > > > Am I missing something obvious here? As I understand it, this is the
> > > > > only code I need in the view to get it working properly, am I wrong?
>
> > > > > Firebug shows no errors and I don't see anything that looks out of
> > > > > place or wrong in the generated source (when the page is built).
>
> > > > > Thanks for your help in advance,
>
> > > > > Dustin Weberhttp://www.dustinweber.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---