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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:37:16+00:00 2026-05-23T23:37:16+00:00

In a Drupal Webform, I’d like to alter the submitted value (e.g. to strip

  • 0

In a Drupal Webform, I’d like to alter the submitted value (e.g. to strip any non-numeric character) when going through the validator.

I follow the validator readme to add in hook_webform_validation_validators and implement the hook_webform_validation_validate hook. However I cannot locate a return parameter to alter the submitted webform value.

For example, if a user enters $12,340, I’d like to fail the submission and update the webform value to 12340.When the user submits the second time, the new value 12340 will pass the validator and be saved.

  • 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-23T23:37:17+00:00Added an answer on May 23, 2026 at 11:37 pm

    I don’t think that the Webform Validation module allows you to change the submitted values. I’ve looked at how it implements the validation and you can do something similar in your own module if you want to change the submitted value.

    The following code is taken in part from http://fleetthought.com/adding-additional-cck-validation-function-field-using-hookformalter and also from the Webform Validation module code.

    function YOUR_MODULE_NAME_form_alter(&$form, &$form_state, $form_id) {
      if (strpos($form_id, 'webform_client_form_') !== FALSE) {
        // Simply add an additional link validate handler.
        $first = array_shift($form['#validate']);
        array_unshift($form['#validate'], $first, 'form_alterations_link_validate');
      }
    }
    
    function form_alterations_link_validate($form, &$form_state) {
      // Access submitted values through $form_state['values']['submitted']
    }
    

    In the form_alterations_link_validate, you can use Drupal’s form_set_value() method to change submitted form values during form validation.

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

Sidebar

Related Questions

I am using the webform module for Drupal 6 and would like to set
Drupal 7. Webforms 3.x. I am trying to modify a webform component value on
I'm looking to add some speacial validation with webform through Drupal. It seems the
I am using Drupal Webform 6.x-2.9 - is there a way (some code snippet
I'm creating a Drupal site for a client, and I'd like to make administrating
I am absolute beginner to drupal. I have added a contact form (using Webform
Drupal seems to have lots to offer to the non-programmer. Tons of modules and
I want to use the Drupal modules Webform and Email Marketing Framework to allow
I am a newbie in drupal, webform and php. Actually I have installed the
is that possible? i use drupal 6 and i want to save webform data

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.