I'm not sure what your $ajax->div tags are doing because I can't locate that
method in the documentation.

To expand on what John said, you will need to add a value to your $options
array in the AjaxHelper method which requests the function

without any other options it would look something like this

$options = array('complete'=>'if(CHECK IF AJAX RETURNED NULL)
$("style").hide();');

the placement of the $options array parameter depends on the Ajax method, so
check http://book.cakephp.org/view/212/Methods to find out where this value
goes.

Be sure to note the *double quotes* around the $("style") .  This is to keep
from breaking the single quotes around the PHP method.  You could also do
something like $(\'style\').hide();

I hope this helps,

Dave

On Fri, Nov 13, 2009 at 4:32 PM, John Andersen <[email protected]>wrote:

> In your javascript which handles the ajax result, just find the node
> (your <tr> element) and set the display property to none.
> Enjoy,
>    John
>
> On Nov 13, 7:28 pm, lauraw <[email protected]> wrote:
> > I have a row that includes a form selection of product styles and is
> > being updated via an ajax->observeField. The update is working great,
> > but I would like to be able to hide the row if no styles are returned
> > by the Ajax request.
> >
> > My view code is:
> >
> > <tr id="style">
> >         <td>Product Style:</td>
> >         <td>
> >                 <?php
> >                                         echo $ajax->div('pstyle_div');
> >                                         echo
> $form->select('Product.product_style_id',
> >
> array($pstyle_options),
> >                                                         null,
> >                                                         array('id' =>
> 'pstyle_sel'),
> >                                                         null);
> >                                         echo $ajax->divEnd('pstyle_div');
> >                 ?>
> >         </td>
> > </tr>
> >
> > I'd like to hide the <tr id="style"> element above if $pstyle_options
> > is empty.
> >
> > Does anyone know a good way to do this?
> > Thanks!
>
> --
>
> 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=.


Reply via email to