how to restrict form submission in drupal form api using PHP - drupal-forms

I have a drupal form, and i want to display and error message based on checking a condition, which in-turn should restrict the form submission, when the error message is displayed.
I was able to do this in Javascript, but seeking how to implement it using PHP.
Can anyone help on this?
Thanks in advance
Vivek R

use hook_validate() and write your validations similar to Javascript..

Related

Mailchimp - Redirect to thank you page

I am using Mail Chimp and in one of my forms when someone registers via custom form, a message appears at the bottom saying 'Check your email for a confirmation email' or something like that. I would like to have them redirect to a thank you page (the standard one will do) instead of a message just appearing, I have been banging my head against a wall trying to figure this out, but I can't seem to find a way to do this.....any suggestions?
The above answer is very vague and doesn't explain fully the process which is explained here in the Mailchimp docs:
https://kb.mailchimp.com/lists/signup-forms/design-and-host-your-own-thank-you-pages
If you check the 'disable all javascript' option then you'll need to perform your own form validation to avoid the form redirecting to a Mailchimp-hosted version of the form if there are errors. Then, once you have submitted the form, it will redirect to your chosen URL.
When creating an embedded form, be sure to disable javascript. There is a check box for it.

Contactform7 not working

My contact7 form is not working, none of the functionality is working, tha ajax and after post validation aren't working. I checked the console for a conflict but there's none. The html is the same i've used on other forms.
This is my form:
disennio.com/clients/lunata/reservaciones/
Looks like you are trying to manually insert the form code on your page. Instead, you'll need to use Contact Form 7's insert a form feature while you are editing that particular page in the WordPress dashboard.
It was mobile plugin related issue, will find another solution for mobile validations. Sorry.

How to validate CaptchaBundle via AJAX?

I'm trying to write form and submit it, validate form via AJAX using Symfony2 and CaptchaBundle. Can anybody give me a hint gow to do this. Any tutorial?

Drupal 6 Ajax module: altering form after submission

I am using Ajax module in Drupal 6 to ajaxify my simple contact form. It works fine, the form is ajax-submitted and validation errors are displayed correctly, but I can't figure out a way to alter my form after successful submission. Namely, I want to remove most of my input fields and replace them with a "Thank you for your request" message. I assume this should be somehow achieved with hook_ajax_validate_pass, but I have no idea how to use it... Any help appreciated.

form validation using ajax/jquery in Joomla

I want to create custom form validation in joomla using ajax or jQuery. on-blur when user input a invalid thing it should validated and show the error and all error messages should read from xml. Please guide me.
use the class name to get control event in joomla instend of controlID with Jquery.
need any further help it then give me more info about your post.

Resources