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

  • Home
  • SEARCH
  • 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 8655485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:02:32+00:00 2026-06-12T15:02:32+00:00

I have a form for gathering an email address, which corresponds to my User

  • 0

I have a form for gathering an email address, which corresponds to my User model. I’d like the form to also have a text field for an email message, but I don’t need the message saved to my database.

echo $this->Form->create('User', array('action' => 'invite','controller' => 'users'));
echo $this->Form->input('User.from', array('label'=>"Your email",'value'=>'your         email','class'=>"",'type'=>'email'));
echo $this->Form->input('User.to', array('label'=>"Your friend's", 'value'=>"your friend's email",'class'=>"",'type'=>'email'));
echo $this->Form->textarea('User.message', array('label'=>'Your message', 'value'=>"some message"));
echo $this->Form->end(array('label'=>'Invite', 'class'=>'buttonstyle')); 

This works, but only if I add a message column to my Users table, which I don’t need. I’d rather do something like this

echo $this->Form->textarea('message', array('label'=>'Your message', 'value'=>"some message"));

But that doesn’t work, I guess because “message” isn’t associated with a model. Is there a better way to do this?

  • 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-12T15:02:33+00:00Added an answer on June 12, 2026 at 3:02 pm

    what do you mean? of course that works, it is a pretty normal/trivial thing to have form fields that do not correspond to a db table field.

    but your initial question is wrong. they usually always belong to a model (a scope so to speak), but not necessarily to a db table. you could even have them without any model related to it. But in most cases this does not make much sense.

    the question is: do you need cake magic for them (auto-generate checkbox/textarea via input() based on the type)? do you want validation for them?
    then you need to consider at least some schema entries for them.

    see http://www.dereuromark.de/2011/12/15/tools-plugin-part-2-contact-form/ for an example how to work with _schema in the model to get all that (as you would with real db fields).

    oh, and

    1. ‘controller’ => ‘users’ doesnt work as you put it, there is only ‘action’ and ‘url’ key.
    2. ‘value’ is just wrong (use ‘default’ instead)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have form where user submits field. Field can have letters, numbers, and punctuation.
I have form like this: <div class=satu> <input type='text' size='1' maxlength='1' name='score[1][]' id='score[1][]'> </div>
I have hierarchical data stored in the datastore using a model which looks like
I have form like this: <input type='text' name='people' id='namepeople'> <input type='hidden' name='idpeople' id='idpeople'> <input
I have form with field: name = forms.RegexField(regex=r'\w+$', label=u'Name', required=True) but if I type
I have form, which i dont want the user to see it. Dont ask
So I am in the process of gathering a user's email address and submitting
I have form, where some fields are looks like rows, so I can add/delete
I have form with multiple input type=radio with text next to them. I want
i have form with user data to input and javascript ajax to send information

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.