"use strict";
const KTSupportModal = function (){
let modal,
form,
validator;
const handle = function (){
validator = FormValidation.formValidation(form, {
fields: {
subject: {
validators: {
notEmpty: {
message: "The site name is required"
}
}
},
"message": {
validators: {
notEmpty: {
message: "The message is required"
}
}
}
},
plugins: {
trigger: new FormValidation.plugins.Trigger(),
bootstrap: new FormValidation.plugins.Bootstrap5({
rowSelector: ".fv-row",
eleInvalidClass: "",
eleValidClass: ""
})
}
});
form.addEventListener("submit", function (e){
e.preventDefault();
console.log(this);
})
}
return {
init: function (){
modal = document.getElementById("kt_create_ticket");
form = document.getElementById("create_ticket");
handle();
}
};
}();
KTUtil.onDOMContentLoaded(function (){
KTSupportModal.init();
});
<div class="form-group fv-row">
<label class="form-label">Subject</label>
<select name="subject" class="form-select form-select-solid">
<option value="" selected hidden disabled>Select subject of your ticket</option>
@foreach($subjects as $subject)
<option value="{{ $subject->id }}">{{ $subject->name }}</option>
@endforeach
</select>
</div>
Firstly, Thanks for your response Sean. I cant add screenshots from the console because completely clear. I'm using the latest version of Metronic and yeah I have one more problem like that on another page. I compared much more times me and base versions then I found a missing part. Missing part like that below:
if (validator)
{
...
}
Hi ,
Great! It just checks if the form validation object is available for the rest of the code.
Regards.
Hi,
Do you have any JS errors in the console? Can you please send your console's screenshots as well ?
May I know which Metronic version you are using? Have you tried it with the latest Metronic v8.0.37 ? Can you please check if other form validation examples work in the original Metronic templates that you are referring to?
Regards.
(I'm adding it here because I made an error while editing) Hello, I tried a lot, but the formvalidation feedback does not appear with the newly added javascript file. Codes: