feat: add a required field

main-dlh
shola 2025-12-05 21:12:49 +07:00
parent c0cf91e0f9
commit 9f2d413f7d
No known key found for this signature in database
GPG Key ID: FA9358FFDCCD05D9
4 changed files with 20 additions and 20 deletions

View File

@ -81,8 +81,8 @@
</div> </div>
<form id="form-edit-rumah" class="mt-6 space-y-4"> <form id="form-edit-rumah" class="mt-6 space-y-4">
<fieldset class="fieldset"> <fieldset class="fieldset">
<legend class="fieldset-legend">RT</legend> <legend class="fieldset-legend">RT <span class="text-red-500">*</span></legend>
<input id="edit-rt" name="rt" type="text" class="input w-full" placeholder="001" /> <input id="edit-rt" name="rt" type="text" class="input w-full" placeholder="001" required />
</fieldset> </fieldset>
<fieldset class="fieldset"> <fieldset class="fieldset">
<legend class="fieldset-legend">Nama Pemilik Rumah</legend> <legend class="fieldset-legend">Nama Pemilik Rumah</legend>
@ -90,9 +90,9 @@
placeholder="Nama lengkap" /> placeholder="Nama lengkap" />
</fieldset> </fieldset>
<fieldset class="fieldset"> <fieldset class="fieldset">
<legend class="fieldset-legend">Alamat</legend> <legend class="fieldset-legend">Alamat <span class="text-red-500">*</span></legend>
<textarea id="edit-alamat" name="alamat" class="textarea w-full" rows="4" <textarea id="edit-alamat" name="alamat" class="textarea w-full" rows="4"
placeholder="Tulis alamat lengkap"></textarea> placeholder="Tulis alamat lengkap" required></textarea>
</fieldset> </fieldset>
<div class="modal-action"> <div class="modal-action">
<button type="button" class="btn rounded-full" onclick="modal_edit.close()"> <button type="button" class="btn rounded-full" onclick="modal_edit.close()">

View File

@ -63,16 +63,16 @@
</div> </div>
<form id="form-create-rumah" class="space-y-4 mt-6"> <form id="form-create-rumah" class="space-y-4 mt-6">
<fieldset class="fieldset"> <fieldset class="fieldset">
<legend class="fieldset-legend">No RT</legend> <legend class="fieldset-legend">No RT <span class="text-red-500">*</span></legend>
<input id="create-rt" name="rt" type="text" class="input w-full" placeholder="Masukkan No RT" /> <input id="create-rt" name="rt" type="text" class="input w-full" placeholder="Masukkan No RT" required />
</fieldset> </fieldset>
<fieldset class="fieldset"> <fieldset class="fieldset">
<legend class="fieldset-legend">Nama Pemilik Rumah</legend> <legend class="fieldset-legend">Nama Pemilik Rumah</legend>
<input id="create-nama-pemilik" name="nama_pemilik" type="text" class="input w-full" placeholder="Masukkan nama pemilik rumah" /> <input id="create-nama-pemilik" name="nama_pemilik" type="text" class="input w-full" placeholder="Masukkan nama pemilik rumah" />
</fieldset> </fieldset>
<fieldset class="fieldset"> <fieldset class="fieldset">
<legend class="fieldset-legend">Alamat</legend> <legend class="fieldset-legend">Alamat <span class="text-red-500">*</span></legend>
<textarea id="create-alamat" name="alamat" class="textarea w-full" rows="4" placeholder="Masukkan alamat"></textarea> <textarea id="create-alamat" name="alamat" class="textarea w-full" rows="4" placeholder="Masukkan alamat" required></textarea>
</fieldset> </fieldset>
<div class="modal-action"> <div class="modal-action">
<button type="button" class="btn rounded-full" onclick="modal_create.close()"> <button type="button" class="btn rounded-full" onclick="modal_create.close()">
@ -259,16 +259,16 @@
</div> </div>
<form id="form-edit-rumah" class="space-y-4 mt-6"> <form id="form-edit-rumah" class="space-y-4 mt-6">
<fieldset class="fieldset"> <fieldset class="fieldset">
<legend class="fieldset-legend">No RT</legend> <legend class="fieldset-legend">No RT <span class="text-red-500">*</span></legend>
<input id="edit-rt" name="rt" type="text" class="input w-full" placeholder="Masukkan No RT" /> <input id="edit-rt" name="rt" type="text" class="input w-full" placeholder="Masukkan No RT" required />
</fieldset> </fieldset>
<fieldset class="fieldset"> <fieldset class="fieldset">
<legend class="fieldset-legend">Nama Pemilik Rumah</legend> <legend class="fieldset-legend">Nama Pemilik Rumah</legend>
<input id="edit-nama-pemilik" name="nama_pemilik" type="text" class="input w-full" placeholder="Masukkan nama pemilik rumah" /> <input id="edit-nama-pemilik" name="nama_pemilik" type="text" class="input w-full" placeholder="Masukkan nama pemilik rumah" />
</fieldset> </fieldset>
<fieldset class="fieldset"> <fieldset class="fieldset">
<legend class="fieldset-legend">Alamat</legend> <legend class="fieldset-legend">Alamat <span class="text-red-500">*</span></legend>
<textarea id="edit-alamat" name="alamat" class="textarea w-full" rows="4" placeholder="Masukkan alamat"></textarea> <textarea id="edit-alamat" name="alamat" class="textarea w-full" rows="4" placeholder="Masukkan alamat" required></textarea>
</fieldset> </fieldset>
<div class="modal-action"> <div class="modal-action">
<button type="button" class="btn rounded-full" onclick="modal_edit.close()"> <button type="button" class="btn rounded-full" onclick="modal_edit.close()">
@ -352,7 +352,7 @@
modal_edit.showModal(); modal_edit.showModal();
}); });
$('#BtnSimpanRumahRw').on('click', function (e) { $('#form-create-rumah').on('submit', function (e) {
e.preventDefault(); e.preventDefault();
modal_create.close(); modal_create.close();
@ -379,7 +379,7 @@
}); });
}); });
$('#BtnUpdateRumahRw').on('click', function (e) { $('#form-edit-rumah').on('submit', function (e) {
e.preventDefault(); e.preventDefault();
modal_edit.close(); modal_edit.close();

View File

@ -114,7 +114,7 @@
<dialog id="modal_edit" class="modal modal-bottom sm:modal-middle"> <dialog id="modal_edit" class="modal modal-bottom sm:modal-middle">
<div class="modal-box w-full sm:max-w-lg"> <div class="modal-box w-full sm:max-w-lg">
<button class="btn btn-sm btn-circle absolute right-2 top-2" onclick="modal_edit.close()">✕</button> <button class="btn btn-sm btn-circle absolute right-2 top-2" onclick="modal_edit.close()">✕</button>
<h3 class="text-lg font-bold mb-4">Tambah Edukasi</h3> <h3 class="text-lg font-bold mb-4">Edit Edukasi</h3>
<form id="form_edit" enctype="multipart/form-data"> <form id="form_edit" enctype="multipart/form-data">
<input type="hidden" id="edit_id" name="Id"> <input type="hidden" id="edit_id" name="Id">
<div class="space-y-4"> <div class="space-y-4">

View File

@ -62,12 +62,12 @@
<h3 class="text-lg font-bold mb-4">Tambah FAQ</h3> <h3 class="text-lg font-bold mb-4">Tambah FAQ</h3>
<form id="form_tambah"> <form id="form_tambah">
<div class="space-y-4"> <div class="space-y-4">
<fieldset class="fieldset text-base"> <fieldset class="fieldset">
<legend class="fieldset-legend">Pertanyaan <span class="text-red-500">*</span></legend> <legend class="fieldset-legend">Pertanyaan <span class="text-red-500">*</span></legend>
<textarea name="Pertanyaan" class="textarea textarea-bordered w-full h-32" <textarea name="Pertanyaan" class="textarea textarea-bordered w-full h-32"
placeholder="Masukkan pertanyaan" required></textarea> placeholder="Masukkan pertanyaan" required></textarea>
</fieldset> </fieldset>
<fieldset class="fieldset text-base"> <fieldset class="fieldset">
<legend class="fieldset-legend">Jawaban <span class="text-red-500">*</span></legend> <legend class="fieldset-legend">Jawaban <span class="text-red-500">*</span></legend>
<textarea name="Jawaban" class="textarea textarea-bordered w-full h-32" <textarea name="Jawaban" class="textarea textarea-bordered w-full h-32"
placeholder="Masukkan jawaban" required></textarea> placeholder="Masukkan jawaban" required></textarea>
@ -94,16 +94,16 @@
<dialog id="modal_edit" class="modal modal-bottom sm:modal-middle"> <dialog id="modal_edit" class="modal modal-bottom sm:modal-middle">
<div class="modal-box w-full sm:max-w-lg"> <div class="modal-box w-full sm:max-w-lg">
<button class="btn btn-sm btn-circle absolute right-2 top-2" onclick="modal_edit.close()">✕</button> <button class="btn btn-sm btn-circle absolute right-2 top-2" onclick="modal_edit.close()">✕</button>
<h3 class="text-lg font-bold mb-4">Tambah FAQ</h3> <h3 class="text-lg font-bold mb-4">Edit FAQ</h3>
<form id="form_edit"> <form id="form_edit">
<input type="hidden" id="edit_id" name="Id"> <input type="hidden" id="edit_id" name="Id">
<div class="space-y-4"> <div class="space-y-4">
<fieldset class="fieldset text-base"> <fieldset class="fieldset">
<legend class="fieldset-legend">Pertanyaan <span class="text-red-500">*</span></legend> <legend class="fieldset-legend">Pertanyaan <span class="text-red-500">*</span></legend>
<textarea id="edit_pertanyaan" name="Pertanyaan" class="textarea textarea-bordered w-full h-32" <textarea id="edit_pertanyaan" name="Pertanyaan" class="textarea textarea-bordered w-full h-32"
placeholder="Masukkan pertanyaan" required></textarea> placeholder="Masukkan pertanyaan" required></textarea>
</fieldset> </fieldset>
<fieldset class="fieldset text-base"> <fieldset class="fieldset">
<legend class="fieldset-legend">Jawaban <span class="text-red-500">*</span></legend> <legend class="fieldset-legend">Jawaban <span class="text-red-500">*</span></legend>
<textarea id="edit_jawaban" name="Jawaban" class="textarea textarea-bordered w-full h-32" <textarea id="edit_jawaban" name="Jawaban" class="textarea textarea-bordered w-full h-32"
placeholder="Masukkan jawaban" required></textarea> placeholder="Masukkan jawaban" required></textarea>