Jump to content

jholcomb

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jholcomb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am extremely new to ajax and would like some help with updating a list via ajax when the user selects a value from a different list. What I have is a dealers list and when a dealer is selected I would like for a sales person list to update so that only salespeople from that dealer show up. I have included the Js helper but that is about as far as I have gotten. I have not been able to find anything at this point that will help do this. It looks as though I probably should use the $ajax->form() but I am unsure of this. Any help is appreciated.
  2. Hi, I have a problem in which I have 3 tables (PotentialLoans, SalesPeople, Dealers) the relationships are as follows. PotentialLoans belongsTo SalesPeople SalesPeople belongsTo Dealers the code I got to work I believe is probably not the best practice for cakePHP the code that works follows public function reply($id = null) { $this->PotentialLoan->id = $id; if (!$this->PotentialLoan->exists()) { throw new NotFoundException(__('Invalid potential loan')); } $this->set('potentialLoan', $this->PotentialLoan->read(null, $id)); $this->set('dealer', $this->PotentialLoan->query("SELECT d.id, d.name, d.address, d.city, d.state, d.zip, d.phone, d.fax FROM potential_loans p, sales_people s, dealers d WHERE p.sales_person_id = s.id AND s.dealer_id = d.id AND p.id =" . $id)); } Any help in cleaning this up would be appreciated. Thank you.
  3. The issue I have is probably a simple one but I am just not getting it and can't find anything on the web to help me. What I have is 3 tables, Table1(PotentialLoan) is related to Table2(SalesPerson) and Table2 is related to Table3(Dealer). Table1 is not related directly to Table3. What I am trying to do is fill out a form, submit it and then create a print page from the data just entered. My print page requires information from Table3 based on the association with Table2. PotentialLoans has a field named sales_person_id linking it to the SalesPeople table I then have a field named dealer_id in the SalesPeople table linking it to the Dealers table I am looking for the best way to get the dealer information based on the salesperson id in order to show in my view The latest attempt looks like this public function reply($id = null) { $this->PotentialLoan->id = $id; if (!$this->PotentialLoan->exists()) { throw new NotFoundException(__('Invalid potential loan')); } $this->set('potentialLoan', $this->PotentialLoan->read(null, $id)); $this->set('dealer', $this->PotentialLoan->SalesPerson->Dealer->find('first', $id)); } This appears to work until you look closer and realize that you are not getting the correct dealer information. All the associations are set up correctly in the models.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.