Form validation is the operation through which form fields are verified to contain the correct input.

learn more… | top users | synonyms

0
votes
0answers
8 views

Error messages not appearing inside of modal

I have a registration form showing up in a Bootstrap modal. I attached a validation function like so, which appears to be working, but when the page reloads, the error messages which I hope would ...
0
votes
1answer
15 views

Setting #element_validate in a form (not form alter) removes original #element validation

I have an element with set #element_validate (in hook_element_info) and I use this element in a custom form. The problem is that when I try to add an additional #element_validate to the element in the ...
0
votes
0answers
15 views

Disable validation for certain part of a (highly nested) form

I have a rather complicated form for events & actions editing. It always includes one 'subform' for an event and N 'subforms' for actions. The #parents hierarchy looks like this (it's more ...
0
votes
2answers
35 views

How to validate node title field Drupal 7

I want to add validation to the node title field. When the user enters the character X and submits the form they should get a message saying "you are not allowed to enter special character X".
1
vote
1answer
22 views

Alter taxonomy autocomplete value

I need to alter the element value of a taxonomy autocomplete field before it is processed and can't seem to find a way of doing so. taxonomy autocomplete fields have an element validator attached, ...
0
votes
0answers
21 views

Webform validation error messages show for some rules, not for others

I'm using Webform with Clientside Validation to create a form. I have created a field with the name 'Address', which is supposed to contain a street name and number. To validate this, I have created a ...
0
votes
1answer
27 views

bypass a character limitation rule (webform)

Maybe someone could help me ... Ive got a webform with an input (postal code). I want its maxlength to be 5. When users fill it, once the 5 digits entered, an autocomplete callback retrieves ...
0
votes
3answers
17 views

conditional validation in webform

I have webform 7.x-3.18+3-dev and webform presav e 7.x.1.1 installed how can I make one field be obligatory depending on another field. Eg if someone selects phone as best form of contact they must ...
-1
votes
1answer
48 views

custom registration form remove username and add validation [closed]

This question relates to Drupal version 7. I'm failing to customise the user registration form, specifically I want to change/add: Default fields remove username from the registration form ...
0
votes
1answer
39 views

Is it possible to change the form submit handler from within a validate handler (need to redirect to another form depending on values entered)

I have an initial webform (based on 3.x of webform module/Drupal 7) that needs to redirect to a second form if yes is specified in a yes/no choice. Otherwise if No, the first form should submit ...
0
votes
1answer
40 views

Checking if a machine_name exists or not

My EntityForm has a field where '#machine_name' => array( 'exists' => array($this, 'load'), To check the validation of this, I wanted to know about writing the function load() in my ...
1
vote
2answers
96 views

Drupal 7 : Programmatically validate form by form ID

Intro - i am trying to implement Sales Force form within Drupal FAPI but now it requires to add captcha so i need to send first request to internal page so i could validate captcha and only after this ...
0
votes
0answers
16 views

Field Validation and Internationalization / Translation

I am using the Field Validation Module as I do need to validate things like phone numbers, emails etc. I like the module, but it seems the CUSTOM ERROR MESSAGE is not translatable. i.e. it doesn't ...
0
votes
2answers
40 views

Multiple validation

I have a problem regarding validation. I have created a custom validation for email, but i want two additional validations for user name and last name. But only email field is getting validated. My ...
1
vote
1answer
79 views

form_set_error message delayed one page refresh

I'm making a custom validation in a form I'm making but my error message is always delayed by one page refresh. $form['submit']['#validate'][] = 'asap_sollicitation_form_validate'; function ...
0
votes
0answers
23 views

Drupal 6 content type sometimes saving blank required fields

First time question - so I hope I do this right. I have a problem where periodically and seemingly randomly new content type nodes with many required fields are being saved to the database with all ...
0
votes
1answer
852 views

How do I validate form elements via onblur events?

I am trying to validate a form element when it loses focus. But I am having issues calling the validation script. I have tried both: drupal_add_js('( function ($) { ...
0
votes
0answers
41 views

Using hook_webform_submission_presave in validation handler

I am trying to modify the value of a hidden email field based on user input before the value is saved to the database and the email is sent. I thin using hook_webform_submission_presave is the way to ...
0
votes
0answers
21 views

Form alter validation

I have a problem with form alter validation when i clear the cache it works will but after that it does not see my code, why is that !? here is my code: function ...
1
vote
0answers
23 views

Why Conditional Fields Validating the Hidden Fields?

I have preset sizes like small, medium and large and an option to provide custom size. If some one selects custom option from a select list the measurements fields appears through conditional fields ...
0
votes
0answers
42 views

set form error inside computed field

I am doing complex calculation using computed field and trying to set form_set_error and stop form submission, also filled values should be retained. form_set_error($field_val, t('Validation ...
1
vote
2answers
54 views

How to test a database connection?

I'm writing a module that will have to make a connection to a seperate database. In order for the user to configure the database, I'm allowing the user to fill out the database connection info in the ...
2
votes
0answers
29 views

Dealing with #disabled and #access in hook_field_validate

is there any way to disable hook_field_validate when the corresponding field widget is disabled (via #disabled = true or #access = false) in corresponding form? Or, alternatively, is there at least ...
1
vote
1answer
30 views

Unable to retrieve user id of edited user from $entity in hook_field_validate

I have this little problem with a custom field that is bundled with user. In its validation function I need to have access to the user id of the user whose field is being edited. What that means is, ...
0
votes
1answer
57 views

Showing a message while downloading a file from hook_form_submit

I have a form which creates a csv file and starts a download if it is successful. I also attempt to show a success message at this point but it never shows up because I use drupal_goto to download the ...
1
vote
1answer
87 views

How to set value in form validate for later validation functions [closed]

Problem I'm adding the user register form onto the node create form with hook_form_alter. The problem is the first step of account validation always fails because Drupal doesn't save Username to ...
0
votes
2answers
173 views

Custom field validation with date time field

I have a content type called 'Event' in which I have used one date time field for storing the event starting and end time. Now I should have a field validation for a that date time field. For example, ...
0
votes
1answer
248 views

Unable to add custom validation rules using client side validation module in Drupal 7

First I want to clarify that I am new to Drupal. So please excuse me If my question is naive. I have installed the Client Side module in Drupal and it is working fine for all the required fields. I ...
0
votes
1answer
31 views

check other commerce pane validation error

I am work on commerce pane, in hook_pane_checkout_form_submit($form, &$form_state, $checkout_pane, $order) I call a function to do something in pane sumbit, something like function ...
0
votes
0answers
48 views

What would cause a form validator with the right naming convention not to execute?

I am supporting a site that uses version 7.x-2.0-alpha of the File Entity module, and a user reported that updating files was not working. Using a debugger and comparing to another site, I tracked ...
0
votes
1answer
36 views

Highlight valid form element

I'm using clientside validation module. It highlights only errors. How to display for example a green mark beside valid form elements?
1
vote
2answers
422 views

How can i remove required field validation on click submit button?

I have some radio buttons such as draft, need review, etc. I want to remove (omit) the required fields when draft is selected, and click on the submission button. I tried with below code but it is not ...
0
votes
0answers
90 views

Custom Validation doesn't work on Webform Multistep with pagebreak

The code below works on a non-multi-step form but doesn't work on a multi-step webform using the page_break. function THEME_form_alter(&$form, &$form_state, $form_id) { ...
0
votes
0answers
241 views

D7 form_set_value : Fatal error: Cannot use object of type stdClass as array in

I want to use the function form_set_value to replace a taxonomy vocabulary by an other in my form. What's happend if the value is not a string, but an object. In this case I have an error. The form ...
0
votes
2answers
150 views

Validate a group of fields so that form can only be submitted if 0 or 2+ fields have been completed

In Drupal 7 I need to validate several cck fields so that the node can only be saved if 0 or two or more fields have been completed. So if only one of the fields is completed validation would fail ...
0
votes
1answer
71 views

User registration silently fails - how to debug?

On our Drupal 7 site, user registration silently fails. Drupal doesn't even reach the form's validation functions. What we checked: disabling javascript didn't help. Removing installed modules ...
0
votes
2answers
60 views

User registration form: Give username “username n+1” value, if and when n is already used

I'm using the first & last name in the user registration form to generate the username for the new user: $firstname = $form_state['values']['field_firstname'][LANGUAGE_NONE][0]['value']; ...
0
votes
0answers
50 views

Webform conditionals limitation problem

I've been asked by the recruitment team to implement a recruitment form for their team. They have sent me a series of instructions. These are (modified for anonimity). I use the latest release of the ...
2
votes
3answers
630 views

Custom validate exposed filter on a view

I have a view with a single exposed taxonomy field that requires the user to click apply before any results are shown. The options in the list appear like this Please Select (All label overridden ...
0
votes
1answer
88 views

comment form custom validation

I am using a custom validation in my Drupal 7 comment form.I want to match the comment_body against a word "example" so if someone just type "example"in the comment body then it will show a error ...
0
votes
0answers
108 views

How to validate and collect errors from CSV import without submission failure

I have been tasked with creating a tool which accepts a CSV and presents it in a spreadsheet display with additional dialogues to explain and link to errors on the display. Have investigated / ...
1
vote
2answers
135 views

Custom Validation while adding a term under taxonomy

I want to use custom validation while adding a term. I used form alter and #validate function it's not working.Default validation function under taxonomy module is working but my custom validate ...
0
votes
1answer
234 views

7: Form: Skip required body field validation

It's possible to skip required body field validation, if it's empty? I can add custom validation on the first place, like: $form_validate = $form['#validate'][0]; $form['#validate'][0] = ...
3
votes
1answer
107 views

Alter default message presented to user on failed login attempt

I need to alter the default D7 message that gets presented to the user on a failed login attempt. I need to give them one message if their username isn't found, and another if their password is wrong. ...
1
vote
1answer
275 views

dynamic fields are not retaining values on form validate (refresh)

I have dependent select list (dynamic dropdown) in my form. When I change a value of the first select list, the second select list is automatically pouplated using ajax callback. Both select fields ...
1
vote
1answer
712 views

How can I skip field validation if the field is hidden?

I get a node form with node_form and then I render it with some modifications. One of the modifications is that I duplicate the fields so I have the same fields twice. One field is disabled and the ...
1
vote
0answers
40 views

Getting rid of the form validation error bubble in Panopoly

In Panopoly, errors that display with form_set_error() do not display in a block at the top of the page the way they normally do in Drupal. Instead they display in a floating popup that looks like a ...
0
votes
0answers
8 views

difference between real click and jQuery click [duplicate]

I create a new subject which is the next of this one. I have a form on drupal. There is a function to create it : commerce_checkout_account_pane_checkout_form There is a function to validate it : ...
0
votes
1answer
248 views

How to prevent button to use validation function?

I have a form with a submit type element and a button type element. For the form I have a validation and a submit handler functions. The validation should occur only when I click on the submit type ...
0
votes
0answers
420 views

form_validate work with ff, not with chrome using jQuery trigger click

I have create a form with form_validate and form_submit functions. Using Firefox, everything is OK so the problem is not about an error in functions names. Using Chrome, when I click on submit the ...