thanks!

used jquery and working fine!



On Fri, Sep 10, 2010 at 12:27 PM, cricket <[email protected]> wrote:

> On Fri, Sep 10, 2010 at 3:04 PM, leafchild <[email protected]>
> wrote:
> > Trying to set up JavaScript for copying shipping information to
> > billing address but it's not going well with CakePHP
> >
> >
> ==============================================================================================================
> > <script type="text/javascript" language="JavaScript">
> > <!--
> > function ShipToBill(box) {
> > if(box.checked == false) { return; }
> > document.sh.Member.data[Member][cc_name].value  =
> > document.sh.data[Member][first_name].value;
> >
> > }
> > //-->
> > </script>
> >
> >
> > <?php echo $this->Form->create('personal', array('name'=>'sh'));?>
> >        <?php __('Add Member'); ?></legend>
> >        Member.first_name:<?=$form->input('Member.first_name',
> > array('label' => false,
> >
>                        'class'=>'',
> >
>                         'div'=>false
> >
>                         ))?>
> >
> >        <br />
> >
> >    <?php
> >          $same = array('1'=>'copy');
> >                         echo $form->input('copy',
> array('type'=>'checkbox',
> >
>     'options'=>$same,
> >
>     'legend'=>false,
> >
>                                                 'label'=>false,
> >
>                                                 'div'=>false,
> >
>                                                 'separator' => ' ',
> >
>
> 'onClick'=>"ShipToBill(this)"
> >
>                                                 ));
> >        ?>
> >
> >   <?php __('billing'); ?></legend>
> >        Member.cc_name:<?=$form->input('Member.cc_name', array('label'
> > => false,
> >
>                        'class'=>'',
> >
>                         'div'=>false,
> >
>                         ))?>
> >
> >        <br />
> >
> >
> =================================================================================================
> >
> > I think JavaScript doesn't like naming "data[Member][first_name]"
> > If I just use simple name such as "firstname" then this JavaScript
> > works fine.
> >
> > Can I still use this JavaScript code to complete this if so how ?? or
> > do I have to use other way??
> > How people usually take care of something like this with CakePHP??
>
> If you have some element wrapping each individual field you could try
> giving them a unique id and using that for jquery's selector.
>
> document.sh.Member.data[Member][cc_name].value  =
> $('#member_first_name_wrapper input').val();
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to