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

learn more… | top users | synonyms (1)

2
votes
1answer
20 views

Correct way to validate config entities?

In Drupal 8, how do I validate a ConfigEntity? I tried adding constraints, but then I found out this only works for ContentEntity, not ConfigEntity. My ConfigEntity has 2 fields, and the options of ...
0
votes
0answers
11 views

is it possible to manipulate manage_file field on validation

Using the form api, is it possible to manipulate the managed_file field inside the validation function. For example if the fid of the field is 15, I want to change it to 10. It seems like it isn't ...
0
votes
0answers
16 views

Change text of validation error message of a field in user register form

On this page i want to change the text of the validation error message RIZIV number: the value may be no less than 10000000000. Its from field field_riziv_number How do i manage this?
0
votes
1answer
46 views

Integer user form field with min 11 digits and max 11 digits

I need an integer form field with has a validation of min 11 digits and max 11 digits. In other words; the user has to fill in an 11 digit code. How do i make this field and validation? Update: I ...
0
votes
1answer
17 views

Managed file input is removing input values of appended input fields by ajax

I have a form with checkboxes that are calling ajax callback on checked. This ajax callback is appending another inputs: $form['expertise']['op-cat-'.$op_cat['id']]['op-'.$op['id']]['checked'] = ...
0
votes
1answer
16 views

What's the usage difference between element_validate and validate hook?

From what i've learned today, there are two ways one can go about validating input. One is the #element_validate field which is passed along the form hook, and the other is the validate hook. Why ...
0
votes
0answers
11 views

Form validation loads on ubercart address before submission

I am using a Drupal 7 with Ubercart 3 and I use Ubercart Addresses to store the user's addresses. Everytime the user selects an other preentered address on checkout form, the validation starts to ...
0
votes
1answer
32 views

Custom form validation

I've created a custom module for populating a database and now I need to apply form validation to this form. I want a few different validation things to happen. I want to limit specific entries on ...
0
votes
0answers
13 views

Client side validation not working for other fields

I have a form with 6 fields every field is set mandatory. I wanted to create a specific rule for one of the fields, my custom validation rule is working fine, but the mandatory fields of client side ...
0
votes
1answer
54 views

How can I enable JavaScript form validation for AJAX submit buttons?

Drupal 8 comes with client-side JavaScript form validation; however, for a submit button with #ajax, it is disabled. How can I enable it?
0
votes
0answers
27 views

Call form validation function by clicking link

I want to be able to click a link on my form and have it call the form's validation function (but not actually submit it!). Here's what I've got that's partially working: in form_alter: ...
1
vote
3answers
171 views

How do I add a custom validation to an existing form/field?

It's all in the title: how to add a custom validation to an existing form (or form field) in Drupal 8? I have a form that I haven't created that I want to alter to execute my own validation rules on ...
0
votes
0answers
20 views

Ubercart Form validation

I have a certain category of product which I wish to limit its shipabality based on cities. The list of cities must be dynamic. I think that could be stored in taxonomy, and the validation could be ...
0
votes
0answers
12 views

During form validation, require user login under special circumstances without interrupting workflow

I'm building a site which aims to inconvenience the user as little as possible. Certain nodes can be created by anonymous users, however they must submit an email address. If the user is logged in, ...
1
vote
0answers
26 views

How do I delay error messages from firing until after a page is loaded

If anyone could please advise me on how to delay $messages from firing until after a page has loaded I would tremendously appreciate it. The issue I'm having is, users are filling out a form ...
0
votes
1answer
19 views

Form_set_error for array of fields

I got below code in form_validation $form_state['values']['field_address'][LANGUAGE_NONE][0][postal_code]; I've tried below tricks but it didn't make red color in textbox. ...
1
vote
1answer
38 views

How can I programmatically remove the file from a managed_file form element?

I have a form where users upload images. When an image is submitted it is validated against various criteria. If the validation fails the user is returned to the form but the failed file is still ...
0
votes
2answers
60 views

How to validate a form against a custom user profile field?

I unsuccessfully tried https://www.drupal.org/project/rules_forms for forms validation so I am writing my own little validation module. Basically, on node creation I want a validation against a ...
0
votes
0answers
6 views

hook_form and jQuery filtering

I'm creating my own "filter form" with hook_form in a custom module and want to use this form to filter mortgages which appear in another div based on specific criteria. I'm having trouble applying ...
1
vote
1answer
45 views

Print message only if checkbox field is alter using form alter

I have created a checkbox in user edit using form alter and based checkbox state I want to print the message. For this I used below code function module_form_user_profile_form_alter(&$form, ...
0
votes
2answers
43 views

Form validation: text has to be a number

I have a textfield in a form that must contain a number. Using an integer for the field type is not possible - it must be text; however, I need to ensure that the input is actually a number. I've ...
0
votes
1answer
40 views

return message after hook_form_submit without Ajax

This might seem trivial to many of you, but how can you return a form with a customized message (according to the fields) in a hook_form_submit ? Like : <?php /** * @file * Pages and display. ...
0
votes
2answers
88 views

Required fields in form not validated

I am currently constructing a form using an Ajax handler. The problem is that since i used Ajax, the submitting part is run without returning any error message. It is only when I clear the cache that ...
0
votes
1answer
94 views

validating textfield input with ajax on every key entry

I'm new to Drupal and Javascript, so please bear with me. I have a simple class project to create custom validation on textfields without using select options or checkboxes. For one of the fields, the ...
0
votes
1answer
38 views

best practice for email validation in form alter drupal 7

What is the best recommended drupal way to validate an email is input on a new field I added in drupal settings page? Here is the code I have now: function ...
0
votes
1answer
14 views

force webform to reload or start from page1 with rules

If for example a field 'start over' is selected, I would like to reload the webform from page 1. Wondering the best way to do this. I already have rules and webform validation enabled. Do I create ...
1
vote
0answers
49 views

How to add confirm form with form alter?

I would like to add a confirm form for the edit page of an entity (commerce product in this case), which only appears when an certain form field has a certain value. I did succeed to set up a confirm ...
1
vote
0answers
24 views

Webform ajax Validation deactivated?

I don't understand why the ajax validation functionality was suddenly deactivated on my WebForm. Perhaps is it possible to activate it again? After fresh webform install all required fields were ...
0
votes
0answers
17 views

Validating Entityform and preventing submission if certain conditions are not set

I'm very new to Drupal. I have an Entityform on a website. Here is what I'm trying to accomplish. 1) Before the form is submitted, check the position 2) If the field_position_available is "Sales", ...
0
votes
1answer
343 views

Create a form programmatically and display result on template

I'm trying to create a simple page with a form. With the different filled fields I want to execute different EntityFieldQuery in the HOOK_form_submit. To finish I want to display the result of ...
0
votes
0answers
51 views

approach custom module userlogin via ajax

for several reasons I try to develop my own module in order to have a fully customizable user login via ajax. Later on I will integrate this in a modalbox. I already wrote the basics of the module, ...
0
votes
1answer
17 views

How to properly delegate form error to parent?

I have a form with multiple radios. I need to display the radios in a certain way(separately with additional form elements) so I had to use radio form elements instead of one radios element. The ...
1
vote
0answers
38 views

Webform validation with multiple conditions

I am wondering if it's possible to verify a webform with the following type of condition: If a text field contains "stringA", then a numeric field must also have a value of at least 20. Or, if that ...
0
votes
1answer
51 views

Unique field value for all nodes and content types

I have list integer field in 3 content types and each have same possible values (from 1 to 6) and I need to disable user to choose the same number for two nodes, so each node with this field filled in ...
1
vote
0answers
21 views

Error messages do not appear on pane, instead appears on top of the overall form

I just added a new checkout pane to checkout form. I am trying to swap its orginal pane validate callback with my custom validate callback as I want my error messages to appear on top of the pane, ...
0
votes
1answer
22 views

Best technique to debug checkout panes

I just need to review/explore the array of built in checkout_panes so that I can debug it. However, the following code does not display any result. <?php function ...
1
vote
0answers
18 views

How to display validation errors to checkout panes

I am trying to validate checkout forms. I did manage to validate checkout form fields but could not display the validation errors to its specific checkout panes. Unluckily the validation for checkout ...
1
vote
2answers
79 views

Redirect to anchor after form validation in Drupal 6

I am trying to redirect user to anchor of error form field after form validation. I have such form and: $form['#validate'] = 'my_form_validate'; Then, in validation function, if the form has some ...
0
votes
1answer
143 views

How to validate webform with JavaScript?

I've got a Webform for which I need additional calculations to hidden fields. I've added a JavaScript file to the page by using drupal_add_js. And let that be the only part that works... My ...
1
vote
1answer
50 views

My form validate function will not run.

I am using Organic Groups. That module has a form where you add new members to a group. I would like to run additional validation on that form. I use hook_form_alter and can identify the form. I add a ...
3
votes
1answer
49 views

How can I validate a path used to create a page?

I'm in the process of creating my first D7 module, partly based on the tutorial found here. It's a pretty simple module that creates both a block and a page to show some content. To go a little ...
1
vote
1answer
50 views

Embedding a custom form in node.tpl.php does not trigger validation

I'm trying to render a custom form in node.tpl.php. The form is rendered properly and submit handler works. However, the validation handler is not triggered properly upon submitting. If I refresh the ...
2
votes
1answer
42 views

Form Validation: Let the comma as separator to be valid in integer field input

I'd like to let my users use separator (Comma) while entering values in an integer field such as price for instance. I know that we can alter the validation of fields with element_validate_integer ...
1
vote
0answers
49 views

How to run validation on hitting the submit button for exposed views filters. Currently it runs on first page load

I am trying to add validation errors to exposed views filters (drop down lists) in block region. However, my validation error runs on the first page load before I hit apply button. Also the ...
1
vote
0answers
18 views

How write form validation to custom content type form? [duplicate]

I am using the drupal 7 content type like my form i dont know how write the form validation to that particular form.
0
votes
3answers
313 views

How to find the default value or change state of a Drupal 8 form element?

I'm putting together a fairly complex form with Drupal 8 (currently building on beta 7). In my validation function, I need to be able to detect whether a field, which was populated with default ...
0
votes
3answers
124 views

webform select options validation unique

I need to prevent two different users from choosing the same option from a webform select options component. In the validation only validation required available, no unique validation. For example: ...
0
votes
1answer
82 views

webform validation integer value

I tried webform validation, I can validate textfield component for numeric value. However, I cannot find how to set it as integer value only. How can I validate numeric (integer) value.
0
votes
0answers
126 views

Why cURL not sending my data to salesforce?

I am using drupal form to build a contact us form. I want to send my contact us data to salesforce. My contact us form has action ...
0
votes
0answers
30 views

Customize validation on node_form

I have a created a content type in Durapl7, and now I want to customize the validation for the add form on the website. Please see attached image for what I got so far, But my main problem is ...