Comments (6)
Hi,
Did you have a solution to trigger vaidation on submit and show errors in each input separatly ? not on a single div ? like :
from ajsf.
You can try the following as used in the Demo:
TYPESCRIPT
import { JsonPointer } from 'angular6-json-schema-form';
formValidationErrors: any;
private _prettyValidationErrors (formValidationErrors: any[]): string {
if (!formValidationErrors) { return null; }
return formValidationErrors.reduce((a, c) => {
const arrMessage = JsonPointer.parse(c.dataPath).reduce((aa, cc) => {
const dd = /^\d+$/.test(cc) ? `[${cc}]` : `.${cc}`;
return aa + dd;
}, '');
return `${a} ${arrMessage} ${c.message} <br>`;
}, '');
};
validationErrors(data: any): void {
this.formValidationErrors = data;
}
get prettyValidationErrors() {
return this._prettyValidationErrors(this.formValidationErrors);
}
HTML
<json-schema-form loadExternalAssets="true" [options]="jsonFormOptions" [schema]="schema" [framework]="selectedFramework" (validationErrors)="validationErrors($event)" >
</json-schema-form>
<div *ngIf="!!prettyValidationErrors" class="data-bad" [innerHTML]="prettyValidationErrors"></div>
CSS
.data-bad { background-color: #fcc; }
from ajsf.
The library already support french language See Here.
Did you try adding language="fr"
like this <json-schema-form language="fr"></json-schema-form>
?
from ajsf.
Thank you, i update my question, i want to trigger validation to each field, your code put all errors in the div ;
but i want to show errors separately
from ajsf.
The library support both options. As I already told you, Did you try adding language="fr"
like this <json-schema-form language="fr"></json-schema-form>
?
from ajsf.
Its ok for the language, bu it shows errors in a same div like that :
and i want them to be shown to each field separately:
from ajsf.
Related Issues (20)
- Error/Validation messages don't appear in red in bootstrap-4. Using CSS did not resolve issue.
- Angular 13 support HOT 1
- validationErrors: submit is enabled even if function return false HOT 1
- Reset Json Schema form
- support bootstrap 5
- Some performances issues with recent versions of Edge ?
- Warnings due to CommonJS or AMD dependencies which can cause optimization bailouts
- additionalProperties aren't displayed HOT 2
- customized widget doesn't return a value HOT 1
- The `None` item in enum dropdown lists considered as `"null"`
- [Question] How to implement your own UI components along with custom styling?
- NullInjectorError: No provider for Framework! HOT 1
- Angular 15 material design support HOT 2
- Get rid of deprecated FlexModule dependency HOT 2
- multipleOf validator uses default remainder operator to validate which results in incorrect result
- Invalid appearance "standard", valid values are "fill" or "outline".
- providing default values to components
- "defautWidgetOptions" typo
- Nested array, last element controls surfaced data
- Fieldset along with the Select all checkbox.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ajsf.