in the wizard after complete function
i did the following
$comeonwork=$this->Wizard->read('state.City.state_id');
$states= $this->State->findById($comeonwork);
// in my email i did this
<?php echo $states ['State']['statename']; ?>
I kept trying to do everything in my _prepareState function
when i needed to do it in my after complete function
On Aug 23, 1:56 am, WebbedIT <p...@webbedit.co.uk> wrote:
> Ahh, so you need the name to be used in an email after the save. In
> that case as Zaky says you have the id so do a find and retrieve the
> name.
>
> $this->MainModel->State->field('name', array('id'=>$this-
>
> >data['MainModel']['state_id']));
>
> HTH, Paul.
>
> On Aug 22, 4:15 pm, arron <w...@wwisinc.com> wrote:
>
>
>
>
>
>
>
> > that maybe true but i cant get that to work using the simple mail and
> > wizard components. I dont necessarily need it to save to the database
> > but just be able to send the name for the state as a email instead of
> > a number
>
> > On Aug 17, 2:08 am, WebbedIT <p...@webbedit.co.uk> wrote:
>
> > > I know Irun the risk of preaching to the converted here, but if you
> > > have a table of states with IDs and Names then you should only ever
> > > save the ID as you never want to save the name more than once. What
> > > if you need to change the name of a state (mis-spelling) you then have
> > > to run multiple updates to change mulitple occurences rather than
> > > changing just the one record in the lookup table.
>
> > > It takes no time at all to then reference the state's name once you
> > > have the ID as Cake will automatically include any belongsTo
> > > associations when running finds on the model and therefore include the
> > > state name in $findResult['State']['name']. Maybe you need to go back
> > > to whoever is saying you need to store the name and convince them
> > > otherwise.
>
> > > On Aug 16, 10:04 pm, arron <w...@wwisinc.com> wrote:
>
> > > > I have a dependent drop down
> > > > using jquery works fine
>
> > > > I found out today that i need to populate the name of the state in
> > > > another table instead of the id.
>
> > > > in my controller i use a simple find to populate the select box.
>
> > > > //controller
>
> > > > $states= $this->State->find('list',array
> > > > ('fields'=>array('State.id','State.state')));
>
> > > > $this->set(compact('states'));
>
> > > > in my view when someone picks the state it populates the city
> > > > then saves it to my users table state_id
>
> > > > //view
>
> > > > <?php echo $this->Form->select('state_id',array($states),'state',array('id'=>'states') ,false);
>
> > > > ?><br /><br /><?php echo $this->Form-
>
> > > > >select('city_id',array('name'),'null',array('id'=>'cites'),false);?>
>
> > > > the problem i am facing is how can i save the state name instead of
> > > > the value ?
>
> > > > if i change my controller to this:
>
> > > > //controller
>
> > > > $states= $this->State->find('list',array
> > > > ('fields'=>array('State.state','State.state')));
>
> > > > $this->set(compact('states'));
>
> > > > It will save the form as i needed it, but my find will not work
> > > > because there is no id for the where clause.
>
> > > > i just need to save my option instead of my id and cant figure it out
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment