Also, looking at your code if you have more then one div named pstyle_sel
then the code will not function as intended. There are two work arounds for
this.
You can either place something in the view to name the div based on a unique
value such as the item id
<div id="pstyle_sel<? echo $data['Item']['id']; ?>";>
and then use this value in your javascript as well:
'complete'=>' if ( $("pstyle_sel' . $data['Item']['id'] . '").length == 0)
$("style' . $data['Item']['id'] . '").hide();'
The option is to use prototype DOM traversal methods up(), down(),
previous(), next() . You can read more about them here:
http://www.phpriot.com/articles/beginning-with-prototype/5
hth,
Dave
On Sat, Nov 14, 2009 at 2:56 AM, David Roda <[email protected]> wrote:
> If the loading div is not hiding it means that the javascript in the
> complete method is throwing an error so the scripts stop running.
>
> I recommend using the Firebug extension for mozilla firefox. After
> installing it you can select the "console" tab. This will display any
> javascript errors as well as let you run standalone javascript commands for
> testing.
>
> I believe the 'loaded' command is a bit of a misnomer. They mention it in
> the documentation. It actually fires after the data is loaded but before
> the view is rendered so it makes sense that it is working off of your the
> previous value
>
>
> On Fri, Nov 13, 2009 at 8:10 PM, lauraw <[email protected]> wrote:
>
>> Okay, bear with me ... I'm learning cake, javascript, and ajax all at
>> the same time :-) ... and prototype
>>
>> I added 'loaded' for observeField() and the javascript code to check
>> the length of the select element
>>
>> if ( $("pstyle_sel").length == 0)
>> $("style").hide();
>>
>> this kind of works. The first time I select something that doesn't
>> have styles, it doesn't hide the row. Next I selected something that
>> did have styles and it HID THE ROW. It's like it's seeing the data
>> from the previous ajax request, like it's one step behind?
>>
>> I'm using 'loaded' instead of 'complete' because when I used
>> 'complete' my ajax loading indicator just kept displaying even though
>> the request was done.
>>
>> Any ideas on why my javascript is lagging? Or have you seen this
>> continual ajax loading indicator when using 'complete'?
>>
>> Thanks, guys for your input!
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<cake-php%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=.
>>
>>
>>
>
--
You received this message because you are subscribed to the Google Groups
"CakePHP" 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=.