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

learn more… | top users | synonyms

0
votes
0answers
18 views

Changing a form value or input field value during the submit handler

I am trying to change the value of a text area field at the end of my submit handler. I have tried using form_set_value and $form['form_id']['#value'] = 'something'; to accomplish this but after ...
0
votes
1answer
21 views

Validating a Webform with CAPTCHA locally before submitting to an external URL

I have the following setup Drupal 6.x Webform 6.x - 3.17 reCAPTCHA 6.x - 1.17 I also have the following custom module function webform_to_data_repo_form_alter(&$form, &$form_state, ...
4
votes
1answer
61 views
+200

How to cache forms with a reverse proxy and deal with stale form tokens?

When Form API generates a form, it also generates a token that is passed out with the form in a hidden field, and expected to be returned back. If it is, the form is processed. If a rendered form ...
0
votes
0answers
22 views

VBO Mass Edit Entity - Tokens and maxlength [closed]

I'm using Views Bulk Operations to modify about 3000 Drupal Commerce product entities. I'm trying to rename the 'Title' and 'SKUs' fields using tokens. The following string is what I am entering into ...
-1
votes
0answers
10 views

Provide value restriction and default field for content from user field [closed]

I am creating a new schools website. Parents and children get separate accounts, and parents should be able to inform the school if the child is not able to attend class, e.g. because of illness or a ...
1
vote
0answers
24 views

Multipage form required field validation problem

I have a 9 page form (content type). In the first page I have a text field which is configured to be required. When this field is empty, and I hit the Next Step button to go the 2nd page of the form, ...
2
votes
1answer
51 views

How to omit form's validation at AJAX button click?

I have an AJAX button that should update form fields according to data already provided by user: 'ajax_button' => array( '#type' => 'button', '#value' => t("Scan for tags"), ...
0
votes
0answers
8 views

Submitting the node form via Panels blanks out Date field values

I have a form made of select fields from the node edit form, displaying on the node view, via Panels. When I press the submit button, it successfully updates the form, but in so doing, it blanks out ...
6
votes
2answers
89 views

How do you change the location of `form_set_error` output?

Is there a way in Drupal 7 to change the location of the output of form_set_error? At the moment, it calls drupal_set_message which queues all the form's errors to the top of the screen. What I ...
0
votes
0answers
9 views

Keep a single webform across a translation set + validations

I'm trying to use a single webform across translations and everything works fine, except validation. The original webform (with attached validators) is ok, but on translated nodes the validators don't ...
0
votes
1answer
29 views

How to bypass required fields in form validation function of a module?

I have a form with two radios and two forms related to each of them. These forms have some required fields. user can just check one radio and then fill in one form. but then clicks on submit button ...
0
votes
1answer
24 views

Setting a validation error via ajax

I am using the formapi to create a form. On one of my fields I have an #ajax call. When the field is changed I call the function. I recreate the form and then replace the whole form on the page. This ...
1
vote
1answer
26 views

Validation error on term-reference field when ajax'd option is submitted?

I get the error "Illegal choice" when I submit a form with a multi-select option that was freshly created via ajax. Workflow is like this: User loads node edit form User needs to select a ...
0
votes
0answers
26 views

using filter_xss for input validation

I am using filter_xss to validate input. eg: if(strcasecmp(trim($input),filter_xss(trim($input))!=0) form_set_error("...."); But the above code is not working correctly for a string containing ...
0
votes
0answers
24 views

Captcha doesn't validate

I'm displaying a custom form in a block. I'm adding a captcha to my custom form like so: function requestform(){ $form['firstName'] = array( '#type' => 'textfield', '#title' => '', ...
0
votes
1answer
59 views

Client Side Webform Validation

I am using Client side webform validation for validating webforms with JS. But it only works when form is submitted. OnBlur validations wont happen till the form is submitted. In the settings onblur ...
1
vote
1answer
66 views

Clientside-validation for form-api for field either digits or empty

A particular form field can be left blank or filled with digits, with no other valid characters including dash"-" $form['hours'] = array( '#type' => 'textfield', '#title' => t('Hours ...
0
votes
2answers
154 views

Override Views Contextual Filter in View Exposed Form Validation

I'm using the Content:Nid contextual filter in my view (with exposed filters) and would like to dynamically set the value of this contextual filter from the exposed form validation callback. Is this ...
3
votes
0answers
34 views

retaining upload file information in form when validation fails on other fields

If there are required fields in a form (ie '#required' is set to TRUE), and the user sets a file to be uploaded but not provide all the required fields, validation fails on the required fields and the ...
0
votes
1answer
48 views

How to implement a cancel button with required elements [duplicate]

I have a form in which I have added a cancel button which looks like this: $form['cancel_button'] = array( '#type' => 'submit', '#value' => t('Cancel'), '#name' => 'cancel', ...
2
votes
1answer
136 views

how to validate file size in drupal file upload

in here file validate extensions are working,but the file size validate is not working,i just need file size only, resolution doesn't matter,i want to restrict max file size to 1MB ...
0
votes
0answers
40 views

#states form with data_popup and select fields type

I'm creating a module with a form using the API form. The form have two field types: the first a date_popup type, second a select type. I need that when the users pick on sundays in the calendar popup ...
0
votes
1answer
51 views

How to tell if a function is being called by javascript?

I have a validation function that is being called either from another php function or a JavaScript call. I was wondering if there is a way to determine if the function is being called by JavaScript so ...
1
vote
2answers
90 views

How to validate a custom widget?

I have created a custom widget that I would like to add some validation to. Specifically, if the widget is marked as required, to check that it actually has a value entered. I figure this should be ...
0
votes
0answers
35 views

Form validation

I am using a Client Validation module for my webforms. I am seeing a "Please enter an email address" pop up bubble next to the email text field when an incorrect email is entered. I am not quite sure ...
0
votes
1answer
70 views

Custom validation for field form?

I'm using below codes in Bartik theme. I need to make: Value cannot be 4 in integer field_total But dont know why not working. function bartik_form_alter(&$form, &$form_state, $form_id) { ...
2
votes
2answers
104 views

white-space and minimum length validation in custom search

I'm using custom search for my website. Now I wan't to validate user input before search like validate white-spaces (just enter space in search box and you'll find all things goes wrong). For minimum ...
0
votes
0answers
54 views

Why file field value is always empty on custom form?

I have created module with custom form. Form is "two step", so first user see radio buttons. If he choose file upload, file field is loaded via Ajax: function rpke_doc_flow_gate_form($form, ...
0
votes
1answer
39 views

Why do I get “Undefined index: mail en comment_form_validate()”? [closed]

Is there a way to fix the notice I get? Notice: Undefined index: mail en comment_form_validate() Notice: Undefined index: homepage en comment_form_validate() This appears in my message area ...
0
votes
0answers
43 views

Why file extension validator does not work?

Created this based on doc comments: http://api.drupal.org/api/drupal/includes%21file.inc/function/file_validate_extensions/7 My upload field definition: $form['xml'] = array( #'#title' ...
0
votes
0answers
34 views

Discard form elements

I would like to know if there is a way to simply not save elements from a form. I know that we can hide elements with hide(), or #type = hidden/value, etc., but I would like to remove then completely ...
0
votes
0answers
43 views

Clientside Validation - Validate fields on key up & Error message placement

If I've got the "Validate fields on key up" option selected as Yes, and the user enters a single character in the email address field, and tab to the next field, should the error message be displayed? ...
1
vote
1answer
34 views

How to check whether content entered by a user in a custom form is valid HTML?

I am trying to write a custom form in Drupal 6 which will check whether the content submitted by a user is valid HTML. If the content is valid I need to generate a txt file with HTML markup based on ...
0
votes
1answer
122 views

How can I show only 3 countries in country list (select box)?

I'm using SMS User module which validates users' mobile numbers. There's a select box and all countries in it. Users select country and write their mobile numbers. I want to show only 3 countries in ...
0
votes
2answers
211 views

Ctools wizard multistep form: Back button should remember entered data

I am building a multistep form using ctools, basically following this approach. Now I want the following behaviour: user is at step 1 enters data for step 1 clicks continue and gets to step 2 enters ...
0
votes
1answer
37 views

How can I send an e-mail whenever user registration fails?

I am a bit concerned that my user registration is too complicated. I have done some basic usability testing, but I'm still not confident, so what I'd like to do is send an e-mail to myself every time ...
0
votes
0answers
53 views

field dependency validation error throwing

I have one field called TYPE(select list). I am using field dependency. When I select one field in TYPE, it will open dependent field. Both are required fields. When I am submitting with out filling ...
3
votes
1answer
179 views

Setting the form value to an organic group gid from validation hook of custom field widget (Drupal 7)

I have a custom widget which can be used for a group audience field. Instead of being a dropdown like the OG_AUDIENCE_WIDGET it is made up of three multiple select list, and the group which is ...
1
vote
1answer
83 views

Will forcing validation on a node save result in security issues or data integrity loss?

I have a content type containing lots of required and conditional fields. Because it can take a bit of time to properly create these nodes, and not all information will always be available to the ...
0
votes
1answer
94 views

Automatic Validation Using drupal_form_submit

I have a content type (call it my_type) with some required fields. One of the fields uses the email module, so if I try and create a my_type node using Drupal's built in node create page and I put ...
0
votes
0answers
68 views

ubercart 2 checkout email validation

I use drupal 6 and ubercart 2. I would like to add better validation for email form on checkout pane. Currently it checks only for @ sign. If I type example@example it is ok. I need it to check for @, ...
0
votes
0answers
79 views

How to change the values of a customer_profile address field in the validation function?

In my checkout form, I have 2 customer profiles: billing (default) and shipping (from commerce shipping module). Basically, I need to emulate the commerce_shipping 7.x-1 option "copy shipping ...
1
vote
0answers
103 views

form_set_error() doesn't work in exposed_validate()

I have made a custom module which implements a new field for Field API and a filter for Views. Everything works like a charm except value validation for exposed filters. I will describe a problem step ...
1
vote
1answer
410 views

Drupal 7 Custom Content form_alter validation

Hi I was wondering if anyone could give me some advice on this. Basically what I have is a custom content type created by the content creator GUI, I am writing a custom module to alter the appearance ...
0
votes
1answer
72 views

How to make a form that captures a value from $_REQUEST[]

Update: This question now has a clone: http://stackoverflow.com/questions/13184335/drupal-how-to-make-a-form-that-captures-a-value-from-request I have been trying to make a form that captures a value ...
1
vote
2answers
83 views

How to restrict creation of content based on unique field values?

I'm not entirely sure how to title this question. I want to restrict the creation of a particular content type to one entry per user per the value of a particular field. So essentially what I'm ...
1
vote
1answer
197 views

Required Fields with unlimited field collection items

I have a D7 instance with a field collection called field_professions and associated to a content type with "unlimited" amounts of fields. Within this field collection I have two fields that are ...
0
votes
0answers
62 views

hook_field_validate doesn't get any items

I'm trying to write a custom field but I'm stuck with strange beahviour: my hook_field_validate apparently works but every $items[$delta] is an empty array! I found that this problem is quite a ...
3
votes
1answer
180 views

Make either of 2 fields required but not both?

Ive added a file field to comments so users can upload a file in a comment as well as post text. How can I make it so one of the 2 fields is required to be filled in to create a comment (so you cant ...
0
votes
1answer
133 views

How I can intercept an image field upload and validate it?

I have a content type with an image field. I need to validate this field because I need to check if user upload a real image or only a file with image's extension (like jpg, gif, png etc). I have ...

1 2 3