Skip to content

Commit

Permalink
Tried turning on validation settings page, looking into more in-depth…
Browse files Browse the repository at this point in the history
… solutions
  • Loading branch information
RyanBirtch-aot committed Nov 8, 2024
1 parent 2110031 commit 523af05
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions components/src/components/Map/Component.form.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import baseEditForm from 'formiojs/components/_classes/component/Component.form';
import EditData from './editForm/Component.edit.data';
import EditDisplay from './editForm/Component.edit.display';
import EditValidation from './editForm/Component.edit.validation';
import AdvancedEditLogic from '../Common/Advanced.edit.logic';
export default function (...extend) {
return baseEditForm(
[
EditDisplay,
EditData,
EditValidation,
{
key: 'display',
ignore: true,
Expand Down
8 changes: 8 additions & 0 deletions components/src/components/Map/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export default class Component extends (FieldComponent as any) {
myLocation,
bcGeocoder,
} = this.component;
const { required } = this.component.validate;
console.log(this.component);

const { readOnly: viewMode } = this.options;

Expand Down Expand Up @@ -178,4 +180,10 @@ export default class Component extends (FieldComponent as any) {
getValue() {
return this.dataValue;
}
isValid() {
if (this.this.component.validate) {
console.log(this.dataValue);
return !!this.dataValue;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import common from '../../Common/Simple.edit.validation';
export default [
...common,
];
export default {
key: 'customValidation',
label: 'Validation',
weight: 10,
components: common,
};
2 changes: 2 additions & 0 deletions components/src/components/Map/services/MapService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ interface MapServiceOptions {
viewMode?: boolean;
myLocation?: boolean;
bcGeocoder: boolean;
required: boolean;
}

class MapService {
Expand Down Expand Up @@ -90,6 +91,7 @@ class MapService {
viewMode,
myLocation,
bcGeocoder,
required,
} = options;

if (drawOptions.rectangle) {
Expand Down

0 comments on commit 523af05

Please sign in to comment.