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 7826901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:37:02+00:00 2026-06-02T09:37:02+00:00

I have problem.. I tried fill up form then click submit button then it

  • 0

I have problem.. I tried fill up form then click submit button then it show form error but all of them textbox field went blank empty with can show form error. I want it become same value from before validate. like i dont want to clear/empty out value after validation.

i did something like this: (in view)

<div class="regform">
        <div id="formleft">First Name<asterix>*</asterix></div>
        <div id="formright"><?php echo $this->Form->input('First Name', array(
                'name' => 'firstname',
                'label'=> false
            )); ?></div>
        <div id="formerror"><?php echo $this->Form->error('Customer.firstname'); ?></div>
    </div>

(in model):

'firstname' => array(
                    'firstname_cant_be_empty' => array(
                            'rule' => 'notEmpty',
                            'message' => 'First Name must be filled.'
                        ),
                    'firstname_must_be_alphabet' => array(
                            'rule' => '/^[a-z]{3,}$/i',
                            'message' => 'First Name is only letters. No numbers, Dotted, etc.'
                        )
                )

(in controller):

if ($this->request->is('Post')) {

            if ($this->Customer->save($this->request->data) && $this->Customer->validates()) {
                //debug($this->request->data);
                $this->Session->setFlash('good!');
                //$this->redirect('/');
            } else {
                $this->Session->setFlash('Fill up form now!');
                $this->data = $this->request->data;
            }

        }
  • 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-02T09:37:05+00:00Added an answer on June 2, 2026 at 9:37 am

    The problem is in your view:

        <div id="formright"><?php echo $this->Form->input('First Name', array(
                'name' => 'firstname',
                'label'=> false
            )); ?></div>
    

    Specifically:

    $this->Form->input('First Name', array(
    

    and

    'name' => 'firstname',
    

    This causes to be the form element to be generated like:

    <input id="UserFirstname" type="text" maxlength="50" name="firstname">
    

    Your form input should instead be this:

        echo $this->Form->input('firstname', array(
                'label'=> false
        ));
    

    Note the differences. This causes the form element to be generated as:

    <input id="UserFirstname" type="text" maxlength="50" name="data[User][firstname]">
    

    The main difference is name="data[User][firstname]". This causes the data to be posted in the familiar array format of $this->request->data, which also allows the form to be repopulated upon form errors.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Setup: I have a form and a Submit button. Ideally the user should fill
I have a small problem, I have tried different solutions to add a image
I have tried troubleshooting this problem and just ended up with nothing, I hope
I have tried this approach/hack: http://blog.blackwhale.at/2009/06/uibuttons-in-uinavigationbar/ The problem is this leaves a faint seam.
I am currently working on Problem 62 I have tried the following code to
I tried searching and didn't find anything that fixed my problem. I have a
i have problem with autorotate on iphone i set up in all classes -
I have a contact form on my website, which actually works :D The problem
I have a form with jquery validation. I have some custom rules, but they
I am facing a problem I have to fill a TextArea programatically. I used

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.