validation

Drupal 7: Adding Captcha field in Node creation Form

The captcha will help to control bot and anonymous users content creation in websites. The captcha system makes will make a challenge for every user to confirm whether the user is human or not. These challenges are mainly used for avoiding spam content creations. In Drupal, there some contribute module will help to achieve captcha for Drupal sites.

Drupal 8 : Webform alter change fields labels, hiding fields, custom validate and submit with example

In Drupal we can alter a form using the HOOK, hook_form_alter(). Webforms are used to create forms in interfaces. We can alter webform using hook_form_alter to change field types, label and custom validate or submit for our purposes. The below example will show editing the webform fields and adding custom validate.

Drupal 7 : Check given Path is valid system path or not with source code

To check given path is Drupal system path or not by using below functions. It check all Drupal system and modules path. It accepts string of path is argument return TRUE if valid path else FALSE if non exist path. We can able to pass wild cards for dynamic paths. For example node/*, comment/*. This function will check these type of paths also.

Drupal 8 : Custom Form Validate and Submit in hook_form_alter() with Example

In Drupal 8 we can able to call custom validate and submit function for our need. This custom functions need to be defined in hook_form_alter(). Validate is defined as array parameter for #validate key of $form array. Similarly for submit is defined as array parameter for #submit on $form submit action.