@@ -12,7 +12,6 @@ import { FormMessageBox } from '@/core/Form/FormMessageBox'
1212import { TextField } from '@/core/TextField/TextField'
1313import { subscribeSchema } from '@/lib/zodSchemas/zodSchemas'
1414import FriendlyCaptcha from './FriendlyCaptcha'
15- import { emailRegex } from './validations'
1615
1716const SubscribeForm = ( ) => {
1817 const locale = useLocale ( )
@@ -22,10 +21,6 @@ const SubscribeForm = () => {
2221 const [ isSuccessfullySubmitted , setSuccessfullySubmitted ] = useState ( false )
2322 const formId = useId ( )
2423
25- const atLeastOneChecked = ( value : string ) => {
26- return value . length > 0 || 'At least one option must be selected'
27- }
28-
2924 const {
3025 handleSubmit,
3126 reset,
@@ -109,9 +104,7 @@ const SubscribeForm = () => {
109104 label = { intl ( 'subscribe_form_general_news' ) }
110105 value = 'generalNews'
111106 aria-describedby = 'atleast-one-category-required'
112- { ...register ( 'categories' , {
113- validate : atLeastOneChecked ,
114- } ) }
107+ { ...register ( 'categories' ) }
115108 aria-invalid = { errors . categories ? 'true' : 'false' }
116109 />
117110 </ li >
@@ -121,9 +114,7 @@ const SubscribeForm = () => {
121114 aria-invalid = { errors . categories ? 'true' : 'false' }
122115 aria-describedby = 'atleast-one-category-required'
123116 value = 'magazineStories'
124- { ...register ( 'categories' , {
125- validate : atLeastOneChecked ,
126- } ) }
117+ { ...register ( 'categories' ) }
127118 />
128119 </ li >
129120 < li >
@@ -132,9 +123,7 @@ const SubscribeForm = () => {
132123 value = 'stockMarketAnnouncements'
133124 aria-invalid = { errors . categories ? 'true' : 'false' }
134125 aria-describedby = 'atleast-one-category-required'
135- { ...register ( 'categories' , {
136- validate : atLeastOneChecked ,
137- } ) }
126+ { ...register ( 'categories' ) }
138127 />
139128 </ li >
140129 < li >
@@ -143,23 +132,14 @@ const SubscribeForm = () => {
143132 aria-invalid = { errors . categories ? 'true' : 'false' }
144133 aria-describedby = 'atleast-one-category-required'
145134 value = 'crudeOilAssays'
146- { ...register ( 'categories' , {
147- validate : atLeastOneChecked ,
148- } ) }
135+ { ...register ( 'categories' ) }
149136 />
150137 </ li >
151138 </ ul >
152139 </ fieldset >
153140 < Controller
154141 name = 'email'
155142 control = { control }
156- rules = { {
157- required : intl ( 'email_validation' ) ,
158- pattern : {
159- value : emailRegex ,
160- message : intl ( 'email_validation' ) ,
161- } ,
162- } }
163143 render = { ( {
164144 field : { ref, ...props } ,
165145 fieldState : { invalid, error } ,
0 commit comments