senters Posted March 7, 2010 Report Share Posted March 7, 2010 Taisot validāciju vārdam, man šobrīd tiek validēts: * min vārda garums - 3 simboli * max vārda garums - 15 simboli * atļauti tikai burti Kā būtu jāpielabo šis nosacījums, lai atļautu arī garumzīmes vārdā un mīkstinājumzīmes? Šobrīd tās neļauj ievadīt. if($vards && !mb_eregi("^[a-zA-Z]{3,15}$", $vards)) { $error_msg[4] = "Nepareizi ievadīts vārds"; } Quote Link to comment Share on other sites More sharing options...
waplet Posted March 7, 2010 Report Share Posted March 7, 2010 ā-Ž Quote Link to comment Share on other sites More sharing options...
waplet Posted March 7, 2010 Report Share Posted March 7, 2010 ā-Ž Quote Link to comment Share on other sites More sharing options...
senters Posted March 7, 2010 Author Report Share Posted March 7, 2010 (edited) Nē, tā nebūs. Nestrādā joprojām // Vārds (min 3 simb, max 15 simb, atļauti tikai burti) if($vards && !mb_eregi("^[ā-žĀ-Ž]{3,15}$", $vards)) { $err03 = "Nepareizi ievadīts vārds<br />"; } Edited March 7, 2010 by senters Quote Link to comment Share on other sites More sharing options...
daGrevis Posted March 7, 2010 Report Share Posted March 7, 2010 Nebūtu pareizāk mb_eregi() vietā izmantot preg_match()?? :) Quote Link to comment Share on other sites More sharing options...
mickys Posted March 7, 2010 Report Share Posted March 7, 2010 Nē, tā nebūs. Nestrādā joprojām // Vārds (min 3 simb, max 15 simb, atļauti tikai burti) if($vards && !mb_eregi("^[ā-žĀ-Ž]{3,15}$", $vards)) { $err03 = "Nepareizi ievadīts vārds<br />"; } // Vārds (min 3 simb, max 15 simb, atļauti tikai burti) if($vards && !mb_eregi("^[a-zA-Zā-žĀ-Ž]{3,15}$", $vards)) { $err03 = "Nepareizi ievadīts vārds<br />"; } varbūt? Quote Link to comment Share on other sites More sharing options...
senters Posted March 7, 2010 Author Report Share Posted March 7, 2010 Paldies mickys, ar šo korekciju darbojās Quote Link to comment Share on other sites More sharing options...
senters Posted August 9, 2010 Author Report Share Posted August 9, 2010 (edited) Esmu atgriezies pie šīs problēmas, ar garumzīmju validāciju. Nestrādā tomēr šī lieta (sk. manu iepriekšējo postu). Tomēr nedarbojas -> if($vards && !mb_eregi("^[a-zA-Zā-žĀ-Ž]{3,15}$", $vards)) Edited August 9, 2010 by senters Quote Link to comment Share on other sites More sharing options...
Леший Posted August 9, 2010 Report Share Posted August 9, 2010 (edited) Ā-Ž man nestrādāja, vienkārši ierakstīju [a-zA-ZāčēģīķļņšūžĀČĒĢĪĶĻŅŠŪŽ] Edited August 9, 2010 by Леший Quote Link to comment Share on other sites More sharing options...
briedis Posted August 9, 2010 Report Share Posted August 9, 2010 Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. Quote Link to comment Share on other sites More sharing options...
senters Posted August 9, 2010 Author Report Share Posted August 9, 2010 [a-zA-ZāčēģīķļņšūžĀČĒĢĪĶĻŅŠŪŽ] Nestrādā šis Quote Link to comment Share on other sites More sharing options...
Леший Posted August 9, 2010 Report Share Posted August 9, 2010 A fails tev noseivots UTFā? Quote Link to comment Share on other sites More sharing options...
briedis Posted August 9, 2010 Report Share Posted August 9, 2010 [a-zA-ZāčēģīķļņšūžĀČĒĢĪĶĻŅŠŪŽ] Nestrādā šis Paprovē iebāzt iekš preg_match(); (neko labu par tām ereg* funkcijām neesmu dzirdējis, parasti lieto preg_*) Quote Link to comment Share on other sites More sharing options...
senters Posted August 9, 2010 Author Report Share Posted August 9, 2010 (edited) Fails jā kā utf-8, ar preg_match nestrādā arī. Vadot "Jānis" saņemu err msg, vadot "Janis" atļauj ievadīt Edited August 9, 2010 by senters Quote Link to comment Share on other sites More sharing options...
briedis Posted August 9, 2010 Report Share Posted August 9, 2010 (edited) Neticu, ka nestrādā! var_dump(preg_match("/^[a-zA-ZāčēģīķļņšūžĀČĒĢĪĶĻŅŠŪŽ]{3,15}$/", $vards)); Edited August 9, 2010 by briedis Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.