On 17 Jan, 20:45, Jakob Malm <[email protected]> wrote:
> Thanks WebbedIT!
>
> Your answer was almost perfect. For some reason, method: 'post' has to
> come before Form.serialize( 'FormID' ) in the list. Now I have /orders/
By the way, I found out about the ordering on
http://code.google.com/p/modalbox/wiki/PassingFormValues
/Jakob
> add showing in Modalbox. The code:
>
> <?php echo $form->create ( 'Order' ); ?>
> Form items...
> <?php
> echo $form->end ( array(
> 'label' => 'Granska beställningen',
> 'onClick' => "Modalbox.show(
> '" . $html->here . "/add',
> { method: 'post', params: Form.serialize(
> 'OrderAddForm' ) }
> ); return false;"
> ) );
> ?>
>
> Side note: I tried to use $html->url(), but it was nowhere to be
> found. Has it been removed? Is the above a safe replacement?
>
> Thanks for the help!
>
> /Jakob
>
> On 17 Jan, 14:53, WebbedIT <[email protected]> wrote:
>
> > There is no 'label' parameter with a submit button, this needs to be
> > changed to 'value'.
>
> > Your 'onclick' parameter also needs a lot of extra information, the
> > main part being 'return: false;' to stop the form from submitting in
> > it's usual manner. Because you are submitting a form through ModalBox
> > you also need to serialize the form data and tell it to use POST
> > method instead of the default GET. All form data will appear in the
> > controller as $this->data as normal.
>
> > If you have not already done so I advise you add the RequestHandler
> > component to /app/app_controller.php as that will automatically switch
> > ajax calls to use the ajax layout. If you want to run any flash
> > messages etc. within your ajax view you will need to copy /cake/lib/
> > views/layouts/ajax.ctp to /app/views/layouts and add your flash
> > message echo in there along with any other layout/content changes.
>
> > Updated code:
>
> > <?php echo $form->end ( array( 'value' => 'Granska beställningen',
> > 'onClick' => "Modalbox.show('/orders/add', {params: Form.serialize
> > ('NameOfForm'), method: 'post'}); return false;" ) ); ?>
--~--~---------~--~----~------------~-------~--~----~
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=en
-~----------~----~----~----~------~----~------~--~---