99 CustomTextArea ,
1010 DropdownMultiSelect ,
1111 CustomUrl ,
12- // CustomCheckbox,
12+ CustomCheckbox ,
1313} from "@formsflow/components" ;
1414import {
1515 removeTenantKeywithSlash ,
@@ -113,7 +113,7 @@ const SettingsTab = (
113113 /* ---------------------- handling form details change ---------------------- */
114114 const handleFormDetailsChange = ( e ) => {
115115 const { name, value, type } = e . target ;
116- const sanitizedValue = value . replace ( / [ # + ] / g, "" ) ;
116+ const sanitizedValue = value ? .replace ( / [ # + ] / g, "" ) ;
117117 setErrors ( ( prev ) => ( { ...prev , [ name ] : "" } ) ) ;
118118 blurStatus . current [ name ] = false ;
119119 let updatedValue = name === "path" ? _camelCase ( sanitizedValue ) . toLowerCase ( ) : sanitizedValue ;
@@ -124,7 +124,7 @@ const SettingsTab = (
124124 }
125125
126126 if ( type === "checkbox" ) {
127- setFormDetails ( ( prev ) => ( { ...prev , [ name ] : e . target . checked ? "wizard" : "form" } ) ) ;
127+ setFormDetails ( ( prev ) => ( { ...prev , [ name ] : e . target . value ? "wizard" : "form" } ) ) ;
128128 return ;
129129 }
130130
@@ -290,19 +290,22 @@ const SettingsTab = (
290290 dataTestId = "form-description"
291291 />
292292 </ div >
293- { /* need to use custom checkbox when component is ready */ }
294- { /* <CustomCheckbox
295- onChange={handleFormDetailsChange}
296- aria-label={t("Allow multiple pages in this form")}
297- id="allow-adding-multiple-pages"
298- label={t("Allow multiple pages in this form")}
299- items={allowMultiplePagesOption}
300- selectedValues={formDetails.display === "wizard" ? ["wizard"] : []}
301- name="display"
302- inline={true}
303- variant="secondary"
304- /> */ }
305- < label
293+
294+ < div className = "ms-4" >
295+ < CustomCheckbox
296+ onChange = { ( e ) => handleFormDetailsChange ( { target : { name : "display" , value : e [ 0 ] , type : "checkbox" } } ) }
297+ aria-label = { t ( "Allow multiple pages in this form" ) }
298+ id = "allow-adding-multiple-pages"
299+ items = { [ { label : "Allow adding multiple pages in this form" , value : "wizard" } ] }
300+ selectedValues = { formDetails . display === "wizard" ? [ "wizard" ] : [ ] }
301+ name = "display"
302+ inline = { true }
303+ variant = "secondary"
304+ size = "small"
305+ dataTestId = "form-edit-wizard-display"
306+ />
307+ </ div >
308+ { /* <label
306309 htmlFor="allow-adding-multiple-pages"
307310 className="input-checkbox"
308311 >
@@ -315,7 +318,7 @@ const SettingsTab = (
315318 name="display"
316319 />
317320 <span>Allow adding multiple pages in this form</span>
318- </ label >
321+ </label> */ }
319322 </ div >
320323 </ div >
321324 < div className = "grid-section" >
@@ -379,7 +382,7 @@ const SettingsTab = (
379382 variant = "secondary"
380383 />
381384
382- < label htmlFor = "anonymouse-checkbox" className = "input-checkbox" >
385+ { /* <label htmlFor="anonymouse-checkbox" className="input-checkbox">
383386 <input
384387 id="anonymouse-checkbox"
385388 type="checkbox"
@@ -392,7 +395,23 @@ const SettingsTab = (
392395 <span>
393396 {t("Also allow anonymous users to create submissions")}
394397 </span>
395- </ label >
398+ </label> */ }
399+ < div className = "ms-4" >
400+ < CustomCheckbox
401+ onChange = { ( ) => {
402+ setIsAnonymous ( ! isAnonymous ) ;
403+ } }
404+ aria-label = { t ( "Also allow anonymous users to create submissions" ) }
405+ id = "anonymous-checkbox"
406+ items = { [ { label : "Also allow anonymous users to create submissions" , value : "isAnonymous" } ] }
407+ selectedValues = { isAnonymous ? [ "isAnonymous" ] : [ ] }
408+ name = "anonymous"
409+ inline = { true }
410+ variant = "secondary"
411+ size = "small"
412+ dataTestId = "form-edit-allow-anonymous"
413+ />
414+ </ div >
396415 </ div >
397416
398417 < DropdownMultiSelect
0 commit comments