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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:38:41+00:00 2026-05-29T23:38:41+00:00

I have a form with a element called price. I validate this element with

  • 0

I have a form with a element called “price”. I validate this element with the “float” validator. The thing is when I insert, for example:

12,50 => it is valid but when I try to save it on the DB (mysql) it is saved as “12.00”

So I wanna to change the decimal character from “,” to “.”. Does anybody knows how??

Note. If I put:

$price->addValidator('Float', 'de')

or

$validator = new Zend_Validate_Float(array('locale' => 'de'));
$price->addValidator($validator)

It does not work.

  • 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-29T23:38:43+00:00Added an answer on May 29, 2026 at 11:38 pm

    You can use a filter Zend_Filter LocalizedToNormalized to it will normalized you localized price according to the user’s locale.

    A typical price element would be like this one:

    $price = new Zend_Form_Element_Text('price');
    $price->setLabel('Price:')
          ->setRequired(true)
          ->setAttribs(array('required name' => 'price', 'maxlength' => '12'))
          ->addFilter('StripTags')
          ->addFilter('StringTrim')
          ->addFilter('pregReplace', array('match' => '/\s+/', 'replace' => ''))
          ->addFilter('LocalizedToNormalized')
          ->addValidator('stringLength', true, array(1, 12))
          ->addValidator('float', true, array('locale' => 'en_US'))
          ->addValidator('greaterThan', true, array('min' => 0));
    $this->addElement($price);
    

    Of course, you can improve it and add the validators/filters you need.

    • 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, called metaDescription : //inside the form $description = $this
I have a form element that I want to address via javascript, but it
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 a form called wizard. Everytime any input element is changed, I want
I have a form element that contains multiple lines of inputs. Think of each
I have a form element defined as: <div class=field> <div class=name> <label for=User_LastName> Last
I have a select form element with 5 options. If option 2 is selected
I have a webpage with a form element and a popup window (opened by
function focus(element) { document.form.element.focus(); } I want to have a function to focus on
I have form called LoginForm, which extends the RecipeForm which in turn extends Zend_Form.

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.