Skip to content

Commit

Permalink
IP-188: added max-length validation
Browse files Browse the repository at this point in the history
  • Loading branch information
papandrk committed Oct 30, 2024
1 parent ad949ba commit 5f9a049
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public function create(): View {
*/
public function store(Request $request) {
$validated = $request->validate([ // bookmark2
'problem-title' => ['required'],
'problem-description' => ['required'],
'problem-title' => ['required', 'string', 'max:100'],
'problem-description' => ['required', 'string', 'max:200'],
'problem-status' => ['required'], // bookmark2
'problem-default-language' => ['required'], // bookmark2
'problem-slug' => ['required', 'unique:crowd_sourcing_project_problems,slug'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
class="form-control {{ $errors->has('problem-title') ? 'is-invalid' : '' }}"
required
placeholder="Problem Title"
maxlength="100"
{{ $errors->has('problem-title') ? 'aria-describedby="problem-title-feedback"' : '' }}
{{-- value="{{ old('problem-title') ? old('problem-title') : $viewModel->problem->defaultTranslation->title }}" bookmark2 --}}
value="{{ old('problem-title') ? old('problem-title') : '' }}"
Expand All @@ -43,6 +44,7 @@ class="form-control {{ $errors->has('problem-description') ? 'is-invalid' : '' }
required
rows="6"
placeholder="Problem Description"
maxlength="200"
>{{-- {{ old('problem-description') ? old('problem-description') : $viewModel->problem->defaultTranslation->description }} bookmark2 --}}{{ old('problem-description') ? old('problem-description') : '' }}</textarea>
<div class="invalid-feedback"><strong>{{ $errors->first('problem-description') }}</strong></div>
</div>
Expand Down Expand Up @@ -156,7 +158,7 @@ class="form-control {{ $errors->has('problem-slug') ? 'is-invalid' : '' }}"

<div class="form-row">
<div class="col-sm-12 mb-3">
<label for="problem-image">Problem Image</label></label>
<label for="problem-image">Problem Image (max-size: 2MB)</label></label>
<input type="file"
id="problem-image"
name="problem-image"
Expand Down

0 comments on commit 5f9a049

Please sign in to comment.