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

learn more… | top users | synonyms

0
votes
1answer
22 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
29 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
60 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
5 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
38 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
47 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
18 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
398 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
32 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
21 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
38 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
47 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
29 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
52 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
77 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
166 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
184 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
29 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
47 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
31 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
301 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
81 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
225 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
116 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
66 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
58 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
43 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
528 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
77 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
99 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
110 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
187 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
102 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
265 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
564 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 ...
0
votes
0answers
34 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
204 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
412 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 ...
0
votes
0answers
183 views

How to validate a AJAX submit form inside lightbox

I have a content type called "Group". I submitted the content type using AJAX. Everything works fine but I am not able to validate the form. Please note that I opened the form in Light Box and I want ...
0
votes
1answer
284 views

Form Validation. Ensure Placeholder is not submitted value

I have a Drupal registration form with a placeholder set on a first name field. I am trying to get the form to check so that if the placeholder value is the same as the submitted value it will give an ...
1
vote
0answers
95 views

user--register.tpl - show validation error messages

I have overwritten theme of registration form using the file user--register.tpl But when have some validation in the form, I cannot see error messages. How can I display error messages generated with ...
1
vote
1answer
125 views

Using clientside_validation project, default validation plugin message not being overridden for states dependent field

I am currently using clientside_validation with clientside_validation_states to validate conditionally required fields. The issue I am experiencing is when the conditionally required element is ...
0
votes
0answers
98 views

How to change server side error message default sequence for content type form in drupal 7?

I used content type for “Add user form” with following sequence. First Name Last Name Email address Confirm Email Address when I submit blank form it shows me server side validation messages ...
2
votes
1answer
379 views

Validating node creation / edit form

I'm using form_alter to play with the node form for a specific content type. This content type has many different fields and I'm also using Field Collection module to organize all these fields & ...
0
votes
1answer
196 views

How to validate temporary files with form API

Problem I have a custom form with three file fields. The files are selected, then on submit they're attached to an email and sent off with a call to hook_mail. I'm pretty sure the files aren't ...
0
votes
0answers
271 views

Add Custom validation with Clientside validation

Can anyone show me an example for adding custom clientside validation in drupal? I need to add my custom validation work with client side validation. I want to make it work my custom validation with ...
0
votes
1answer
37 views

how to check whether an error occurs due to a specific field in drupal?

Inside a validate function how can I disallow errors for a specific field and allow errors for a specific field. Like if I get errors for a field_abc I would like to clear that specific error and ...