min_length
और max_length
सत्यापन बाधाओं के लिए CodeIgniter
में कस्टम सत्यापन संदेश सेट करने का प्रयास करते समय मुझे एक त्रुटि मिल रही है।प्रमाणीकरण max_length, codeigniter में min_length
ये मेरी मान्यता नियम हैं:
$this->form_validation->set_rules('username', 'Username', 'required|xss_clean|min_length[6]|max_length[10]');
$this->form_validation->set_rules('password', 'Password', 'required|min_length[8]|max_length[20]';
ये अपने कस्टम सत्यापन संदेश हैं:
$this->form_validation->set_message('min_length[3]', '%s: the minimum of characters is three');
$this->form_validation->set_message('max_length[20]', '%s:the maximum of characters is 20');
मेरे उदाहरण में हम दो क्षेत्रों है, लेकिन मैं अलग न्यूनतम और अधिकतम लंबाई के साथ कई क्षेत्रों है मान। वे सभी एक विशिष्ट बाधा मान्यताओं है। यह संदेश काम नहीं करता है। संदेश डिफ़ॉल्ट रूप से प्रकट होता है। आपकी सहायता के लिए धन्यवाद.
$this->form_validation->set_rules('password', 'Password', 'required|min_length[8]|max_length[20]');
अद्यतन
शायद एक callback समारोह का उपयोग कर बेहतर होगा: )
-
मेरे स्रोत कोड में यह ठीक है।जब मैंने अपनी पोस्ट की थी तो मैं बंद होने पर भूल गया था। मेरा संदेह जारी है। आपके सुधार के लिए धन्यवाद। – cabita
@ कैबिटा - मैंने अपना जवाब अपडेट कर लिया है। – stealthyninja
धन्यवाद, मैं आपके उत्तर की समीक्षा करूंगा। धन्यवाद। – cabita