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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:23:29+00:00 2026-06-03T02:23:29+00:00

In my Controller I have some set of data, and some values can not

  • 0

In my Controller I have some set of data, and some values can not be sent from client (it’s not an error in my logic), and I don’t modify corresponding fields in database. But I want to throw an error if the value is an empty string.

How can I to do it with standard validators?

Example:

I have table users with 2 fields: username and password. User in his profile can change any of them or both. Profile is written in ExtJS 4 with proxy configured with option writeAllFields: false, so client sends to server only modified fields.

On server side, if, for example, username not found via

  • $this->_request->getPost('username')
  • $this->_getParam('username')

… or something else (it’s null), I do not want to validate it and modify it in database.

BUT if user typed an empty string in username field, I want to validate it and show an error to user with text like “username cannot be empty”.

How can this be accomplished?

  • 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-03T02:23:30+00:00Added an answer on June 3, 2026 at 2:23 am

    Personally I would filter the input and then validate it. But to achieve your objectives, this would probably do the trick, its straight from the docs.

    $valid = new Zend_Validate_NotEmpty();
    $value  = '';
    $result = $valid->isValid($value);
    // returns false
    

    What drew010 mentions applies if you are using Zend Form to create the form. In that case setting the setRequired() validator to true on the element itself will display an error to the user if no input is supplied. If your not using Zend Form, then the above should point you in the right direction.

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

Sidebar

Related Questions

I am getting some unexpected behavior from Html.EditorFor(). I have this controller: [HandleError] public
I have a view controller that gets presented modally and changes some data that
I have a spring action that I am rendering some json from the controller,
I am trying to make some data from database available using XML, I have
I have a controller where I am adding some registration values to the table,..
I have a controller user with a method login For some reason, when I
I have an controller which is an ArrayProxy and contains some computed arrays. In
My site is open to all but i have a controller with some method
I have this in my controller. I need my view to generate some HTML,
I have spent quite some time going through similar questions here and have not

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.