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

learn more… | top users | synonyms

0
votes
0answers
13 views

How to prevent to create duplicate node on clicking submit button multiple time

I am using unique_field module. If a node already created and i want to create node with duplicate title(title is selected as unique field), it work fine. But if i click on submit button multiple ...
0
votes
1answer
20 views

Remove field data in submit function

Drupal 7. On form validate, I want to: check the value of one of the form fields [field-1] based on that value, completely remove another field [field-2] together with its values, from the form If ...
0
votes
0answers
28 views

validate field using regular expression in Field validation module

I have added a text field in a content type. I'm looking to validate that field by adding a Rule using "Field Validation" module. I found few options in this module like regular expression ( Regular ...
6
votes
1answer
62 views

How to use #element_validate and #value_callback in Drupal 8

I have followed the official Form API Documentation, but this code don't work for me on Drupal 8: public function buildForm(array $form, FormStateInterface $form_state) { $form['upload'] = ...
0
votes
1answer
47 views

Custom Password validation on Drupal 7 form

I am using the Drupal Form API for a customized Login System. It has the password field which needs to be validated. We have a custom criteria of Uppercase, Lowercase, numeric and special characters ...
0
votes
0answers
24 views

URL validation issues, using valid_url

I want to validate URL's. Drupal's check, on field settings, "Validate URL", does not work appropriatelly. I perform custom validation, but there are some problems. I used idn_to_ascii in order to ...
0
votes
2answers
47 views

Email validation on Drupal 7 default form Api without installing any modules

I am using Drupal Form API to create forms. What is the way to add email address validation without having to install any separate modules? Thus I am just looking for out of the box functionality. ...
0
votes
1answer
71 views

How to add special character validation on specific field in form registration process

I want to add a special character validation on a specfic field. Here I have my code but it does not work and there is no error. function mymodule_form_alter(&$form, &$form_state, ...
0
votes
2answers
68 views

Validation and Setting value for Multi-value fields

Consider for a content type, there is a text field with multiple values capability activated. How can I check its values by $form_state inside the Validate/Submit function? How can I set its values ...
0
votes
1answer
115 views

Preventing users from registering with xxx@yyy format email address

Drupal seems to let users register with emails like xxx@yyy I heard that this kind of email address can exist. But I want users to register with only emails like xxx@yyy.zzz Is there any way to ...
0
votes
0answers
60 views

How to override form_error in webform_validate_unique function provided by webform.components.inc

I have a Webform module provided form that will be used by anonymous users. I need to avoid duplicate submissions from the same user, but can't rely on cookies or IP address (multiple users at same ...
0
votes
1answer
23 views

Custom content type add form

I am brand new working with Drupal 7 and I am working on a professional project and I would like some help to achieve some requirements. We have some content types like associations. Authenticated ...
0
votes
1answer
133 views

Unable to set field collection field value on form validation

The question might look similar to How to form_alter fields attached to an unlimited field collection? but I am more concerned about "values not saved after custom validation" I have a field ...
0
votes
2answers
52 views

client side validation

I am new to Drupal. I am trying to enable client side validation on my web forms. I installed & enabled the modules as per the Drupal.org link: https://www.drupal.org/node/1324924 & then went ...
0
votes
1answer
90 views

Drupal 8 custom validate user register

I've created a module for Drupal8 that checks against values in the user register and set an error if the values do no match with something you have entered in a custom form. My module has got a form ...
0
votes
1answer
64 views

Red border error indication is not generated

I am making a shopping store site with D7 and commerce. In the check out pane page, there are several form fields for information of customers such as name, address, phone, and so on, have set up ...
0
votes
1answer
70 views

validation of text box and checkbox

I am trying to validate the form. I have one hidden textbox and one check box group. field_institute_event - represents checkbox group. posted_student_list - represents hidden text box. If both ...
0
votes
1answer
50 views

How to validate input data that are previously saved?

I am creating a module that can store user input in db and populate in a listing page with validation. I am collecting all values before submit i.e. any change in any field I store the form state in ...
0
votes
1answer
41 views

drupal_validate_form not validating more than one time on listing page

i am using drupal_validate_form on a node listing page . it is validating it correctly only for 1st item after that it is not checking validation. here is my code foreach($result as $r){ ...
0
votes
1answer
25 views

Not validating required validation

drupal_validate_form is not validating required validation when i was creating a node programatically . Can any one say, it is design like that or am i doing something wrong . $node_form = ...
3
votes
2answers
321 views

Sorry, unrecognized username or password error after successful login

In user_login block form alter I'm attaching a validator : ws_res_auth_authenticate ( the last one in the dsm output below) and logging in a user using this code: user_login_submit(array(), ...
0
votes
0answers
23 views

file_validate_size doesn't seem to work

I'm currently learning how to make a custom module that creates a block with a textfield and upload field. So far so good, only thing is: Drupal doesn't seem to respect my file_validate_size value. ...
1
vote
1answer
92 views

Password may contain illegal characters

Is it possible to change an option or overwrite the password validation so that a user can add characters like é to their password?
0
votes
0answers
28 views

required validation fails in drupal_validate_form when creating node programatically

drupal_validate_form not validating the required validation . when i was trying to create a node programatically all the validation works fine except required validation is this process like that or ...
0
votes
1answer
71 views

How to save a form inputs in database and retrieve it from database with out form submision

hi can i store form inputs in database and retrieve it from database with validation I search many sites but neither any documentation or example or any thing i found for drupal7 . I didn't ...
0
votes
0answers
46 views

Custom validation with conditional fields

I have a content_type campusactiviteit which has a lot of conditional fields. When the user hits "catering" three fields appear: "kostenplaats", "bestelbonnummer" and "soort_catering". When the user ...
0
votes
1answer
48 views

How to show validate error of a node listing page

i am trying to save form state in database and want to view in a listing page with its error validation. i.e, i want to validate a previously saved form state from my database. this is a node type ...
0
votes
0answers
214 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
45 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
25 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
156 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
58 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
92 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
59 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
100 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 ...
0
votes
1answer
118 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
96 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
281 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
45 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
48 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
2answers
221 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
42 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
2k 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
81 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
24 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
39 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
65 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
145 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
39 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
35 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, ...