I try hack on edituser.php to make the age field be autofill in when after keyin the year of birth. i think i almost there but just can't get the 'year of birth' value,
1. I have replicate the formtext.php change it to formyear.php Here is the code i change on my formyear.php:
Class and Function already change to 'XoopsFormYear' and
I had do some hack on edituser.php and function.php to do a validation for some fields. like Full Name field will only allow to enter alphabet and phone number only allow numbering. this two function is working fine with the code below.
function checkname($name) { if (!$name || !preg_match("/^[a-z @]+$/i",$name)){ return false; } return $name; }
function checkphone($tel_hp) { if (!$tel_hp || !preg_match("/^[0-9-]+$/i",$tel_hp)){ return false; } return $tel_hp; }
Now i would like to add in a field length validation for postcode, Example: if the post code field enter more than 5 or less than 5 digit, the error message will show out.
But i have no ideal how to check the length, below is the code i try and actually not work. I hope to get any one have experience or ideal to do the length validation.
function checkpost($post) { for ($i=0; $i<strlen($post); $i++) { if ($post.charAt(i) < 5){ return false; } } return $post; }
No, i mean like to add a 'mail' button at top / bottom on userinfo.php for admin only, when click on it will bring me to a screen like recommend friend to fill in the name and email to send the profile details.
the email i key-in will receive the profile details.
look like the XoopsFormDateTime not really work for my site. when i use this format the result will show as 'array'
When i try this XoopsFormTextDateSelect it show me the correct result '1980-3-11', but the problem is everytime when i click into edituser.php the date field will change back 1970-1-1.