Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix frontend to properly map the violations in validation-quickstart #1389

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,50 @@
<div class="container-fluid">
<div class="row-fluid hidden" id="result">
<br />
<div id="suc" class="col-md-6 col-md-offset-2 toast-pf alert alert-success">
<span class="pficon pficon-ok"></span>
<p class="message"></p>
</div>
<div id="err" class="col-md-6 col-md-offset-2 toast-pf alert alert-warning">
<span class="pficon pficon-warning-triangle-o"></span>
<p class="message"></p>
<div class="col-md-12">
<div id="suc" class="col-md-7 col-md-offset-2 toast-pf alert alert-success">
<span class="pficon pficon-ok"></span>
<p class="message"></p>
</div>
<div id="err" class="col-md-7 col-md-offset-2 toast-pf alert alert-warning">
<span class="pficon pficon-warning-triangle-o"></span>
<p class="message"></p>
</div>
</div>
</div>

<div class="row-fluid">
<br />
<form>
<div class="form-group row-fluid">
<div class="form-group row">
<label for="title" class="col-sm-2 col-form-label">Title</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="title" placeholder="Book title">
</div>
<div class=col-sm-2">
<div class="col-sm-2">
<em>Must not be blank</em>
</div>
</div>
<div class="form-group row-fluid">
<div class="form-group row">
<label for="author" class="col-sm-2 col-form-label">Author</label>
<div class="col-sm-7">
<input type="text" class="form-control" id="author" placeholder="Book author">
</div>
<div class=col-sm-2">
<div class="col-sm-2">
<em>Must not be blank</em>
</div>
</div>
<div class="form-group row-fluid">
<div class="form-group row">
<label for="page" class="col-sm-2 col-form-label">Number of pages</label>
<div class="col-sm-7">
<input type="number" class="form-control" id="pages" placeholder="Number of pages">
</div>
<div class=col-sm-2">
<div class="col-sm-2">
<em>Must be positive</em>
</div>
</div>
<div class="form-group row-fluid">
<div class="col-sm-10">
<div class="form-group row">
<div class="col-sm-12">
<button id="try-manual-validation" type="button" class="btn btn-primary">Try me - Manual validation</button>
<button id="try-end-point-method-validation" type="button" class="btn btn-primary">Try me - End point method validation</button>
<button id="try-service-method-validation" type="button" class="btn btn-primary">Try me - Service method validation</button>
Expand Down Expand Up @@ -141,7 +143,7 @@
}).fail(function (jqXHR) {
$("#result").removeClass("hidden").show();
if (jqXHR.responseJSON) {
$(".message").html($.map(jqXHR.responseJSON.parameterViolations, function(v){
$(".message").html($.map(jqXHR.responseJSON.violations, function(v){
return v.message;
}).join(', '));
} else {
Expand Down
Loading