Field validation

We sometimes get data from our petition page that is obviously bad - for example, the required "Address" field will accept "a", and the required phone number field will even accept a non-number like "z". Is it possible to add custom client and/or server side validation to fields? The built-in email field has this already - it won't accept anything without an "@" symbol, and it is checked both client- and server-side. Just a basic field-length check would eliminate most mistakes and any particularly crude bots. Or a more sophisticated check might be able to tell that a home phone number is mobile (in Australia, all mobile numbers start with 04 or +614), and put it into the mobile phone number field instead. While it would presumably be possible to add validation javascript to a page template (is there a clean way to do this?), that wouldn't help for server-side validation at all.

Official response from

Hi Wade,

You are correct in that a very limited amount of validation is already in place (with the email address, for example), but we do not have plans to add further validation to other fields due to the degree to which address and phone number syntax varies between different countries across the globe. With that being said, adding additional client-side validation using JavaScript is possible. Implementation of this is complex, but should be feasible for someone with experience with JavaScript. Here are some links that may help out:

It is worth noting that the ID of a form can be found using the 'inspect element' tool when viewing your webpage and that any element of a form, including the "Submit" <input> tag, can be added as HTML instead of using Liquid tags by copying the HTML from the "HTML Source" of the live page and pasting it over the liquid tag. 

For assistance with adding client-side validation, NationBuilder maintains a listing of certified Architects, or web developers, who are pros at making customizations to NationBuilder sites and themes:

As far as server-side validation goes, this would need to be a product change made on our end, as it is not possible to add server-side validation from a NationBuilder control panel or theme. If you'd like to see additional server-side validation added to the platform, feel free to post a feature suggestion at



Complete and current information on how to use NationBuilder is available in the documentation section.

Share this post

Showing 3 reactions

How would you tag this suggestion?
Please check your e-mail for a link to activate your account.