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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:50:11+00:00 2026-05-12T17:50:11+00:00

I have a Zend_Form $form = new My_Form(); $uploadedData = $form->getValues(); Zend_Debug::dump($uploadedData, $form->name,true) and

  • 0

I have a Zend_Form

$form = new My_Form();
$uploadedData = $form->getValues();
Zend_Debug::dump($uploadedData, $form->name,true)

and when i dump the form values i get a string array

array(11) {
  ["event"] => string(2) "26"
  ["firstname"] => string(3) "sdf"
  ["surname"] => string(0) ""
  ["gender"] => string(1) "M"
  ["company"] => NULL
  ["dateOfBirth"] => string(10) "11-11-1977"
  ["address"] => string(6) "dfasdf"
  ["address2"] => string(4) "adfs"
  ["address3"] => string(4) "adfs"
  ["email"] => string(7) "x@x.com"
  ["mobile"] => string(0) ""
}

The form has the same number of fields as my DB table, the DB table def is

DROP TABLE IF EXISTS `registration`;
CREATE TABLE IF NOT EXISTS `registration` (
  `id` int(11) NOT NULL auto_increment,
  `event` int(11) NOT NULL,
  `firstname` varchar(50) NOT NULL,
  `surname` varchar(50) NOT NULL,
  `gender` varchar(5) NOT NULL,
  `dateofbirth` date NOT NULL,
  `address` varchar(50),
  `address2` varchar(50),
  `address3` varchar(50),
  `email` varchar(50) NOT NULL,
  `mobile` varchar(50),
  `company` int(11),
  `sector` int(11),
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

I’m getting a mapping error at the moment, since the DB event column can’t take a string, and
same with the ‘dateofbirth’ column

if($form->isValid($formData))
{
    $logger->info("valid form");
    $table = new Model_DbTable_Registration();
    ... // apply some custom mapping??
    $table->insert($uploadedData);
    ...    
}

I don’t want to have to manually create a new array, and map each form field to the correct type by name – it
seems like a pain. Is there a smarter way to do this mapping in Zend?

  • 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-05-12T17:50:11+00:00Added an answer on May 12, 2026 at 5:50 pm

    That is why on the new ZF version is using the DataMapper Pattern for things like this, you abstract completely how to set, save and retrieve the data.

    Your best bet is to create a new class and then interact with that class, and internally that class interact with your DbTable class.

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

Sidebar

Related Questions

I have a Form element: $Form=new Zend_Form; $Form->setAction($this->view->url(array('controller'=>'auth','action'=>'create'),null,true)) ->setMethod('post') ->setAttrib('id','auth-form') ->removeAttrib('enctype'); As can be
I have this simplified form: $this->form = new \Zend_Form(); $this->form->setAction($request->currentPath()); $this->form->setMethod('post'); $this->form->addElement('text', 'firstName', array(
I have a simple Zend-based form with reCaptcha element: $form = new Zend_Form(); $form->setName('forgotpassword')
I have a Zend_Form with file element like this: ->addElement('file', 'image', array( 'required' =>
I have form called LoginForm, which extends the RecipeForm which in turn extends Zend_Form.
I have the following element in my form: $attachment = new Zend_Form_Element_File('attachment'); $attachment->setLabel('Attach File
I have an issue where I cannot seem to get the values to re-populate
I have validator error translator connected with my Form class My_Lib_Forms_Form extends Zend_Form {
Server side extjs form validation using zend framework I have extended Zend_Form class to
I am new to zend framework. I have used zend form and decorators to

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.