feat(prescriptions & auth): auto-create user and pet profile on prescription submit, validate mobile numbers with regex, allow public upload and auto-reset form state
Deploy Canina / deploy (push) Waiting to run
Deploy Canina / deploy (push) Waiting to run
This commit is contained in:
1 parent
b617331683
commit
4e304944ef
5 files changed
+103
-17
No files matched your search
@@ -35,10 +35,17 @@ export default function ContactFormClient() {
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (!name.trim() || !phone.trim() || !message.trim()) {
|
||||
const cleanPhone = phone.trim();
|
||||
if (!name.trim() || !cleanPhone || !message.trim()) {
|
||||
setError("لطفاً نام، شماره موبایل و متن پیام را وارد کنید.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!/^09\d{9}$/.test(cleanPhone)) {
|
||||
setError("شماره همراه وارد شده معتبر نیست. (مثال: ۰۹۱۲۳۴۵۶۷۸۹)");
|
||||
return;
|
||||
}
|
||||
|
||||
setError("");
|
||||
setLoading(true);
|
||||
|
||||
|
||||
Reference in new issue
Block a user