Need Regex as an option for Dependent Field

I’m looking to have a text field (“Promo Code”) be rejected if one of several values is not entered.

I do not see an option for RegEx on the form field, is there a reason? Did this get changed?

Hi @Chris_iExcel,

There is currently no option in the HubSpot user interface for this, correct. However, HubSpot has shared in a previous post how to approach this. https://community.hubspot.com/t5/APIs-Integrations/How-to-work-with-jquery-custom-validation-for-hubspot-form/td-p/226633


Hi @nutan, we don’t have a very easy way to override HubSpot default validation with custom validation, but you should be able to put your own validation code in the onFormSubmit callback that’s detailed here: https://developers.hubspot.com/docs/methods/forms/advanced_form_options. This thread goes over a few more options: Integration with JQuery Validator - customized validation you may want to explore, as does this Medium article: https://rschu.me/prevent-the-submit-of-any-hubspot-forms-after-a-successful-validation-5e1f230b14f1


Hope this helps!