Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8388761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:32:34+00:00 2026-06-09T18:32:34+00:00

my function puts the correct value into the form for my view but doesn’t

  • 0

my function puts the correct value into the form for my view but doesn’t save the correct value in the database. The database is saving the accounts_users.id NOT the accounts_users.account_id to my the code looks like it should be entering the persons accounts_users.account_id. I see the correct information in the dropdown box in the form

add function

function add(){

    $accounts=$this->User->AccountsUser->find('list', array(
'fields'=>array('id','account_id'),'conditions' => array(
'user_id' => $this->Auth->user('id'))));

    if($this->request->is('post')){
      $this->Template->create();

      if ($this->Template->save($this->request->data)) {
        $this->Session->setFlash('The template has been saved');
        $this->redirect( array('controller' => 'Fields','action' => 'add'));
      } else {
        $this->Session->setFlash('The template could not be saved. Please, try again.');
      }
    }

here is the add view

<?php
echo $this->Form->create('Template', array('action'=>'add'));
echo $this->Form->input('name',array('label'=>'Template Name: '));
echo $this->Form->input('account_id',array('label'=>'Business: ', 'type' => 'select', 'options' => $accounts));
echo $this->Form->input('description',array('label'=>'Short Description Of Template: '));
echo $this->Form->end('Click Here To Submit Template');
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:32:35+00:00Added an answer on June 9, 2026 at 6:32 pm

    Try the following code:

    function add(){
    
    $accounts=$this->User->AccountsUser->find('list', array(
    'fields'=>array('account_id','account_id'),'conditions' => array(
    'user_id' => $this->Auth->user('id'))));
    
    if($this->request->is('post')){
      $this->Template->create();
    
      if ($this->Template->save($this->request->data)) {
        $this->Session->setFlash('The template has been saved');
        $this->redirect( array('controller' => 'Fields','action' => 'add'));
      } else {
        $this->Session->setFlash('The template could not be saved. Please, try again.');
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a function that puts the class, length, and value of
I have the following to execute shell commands using Node: function puts( error, stdout,
Considering this code with 3 differents function call semantics: void f(void){ puts(OK); } int
function cookiesToSession() { foreach($_COOKIE as $key => $value) { $_SESSION[$key] = $value; } }
function LolClass(){ this.init = function(){ button_a.bind(tap, function(){ this.refreshFields(); // doesn't work //refreshFields(); // doesn't
I have a form: <form name=emailform id=emailform onsubmit=emailSubmit() method=post><div> <input type=text id=email name=email value=>
I want to use this function from mongoid: person.update_attributes(first_name: Jean, last_name: Zorg) But I
I have a jQuery selector with following syntax: $('input[type=image]').not('.xyzClass').click(function{ //some functionality }); So this
I'm trying to write a fabric function that puts a script on a remote
I have this code, which uses ob_start php function. Which basically puts the echoed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.