grafis Posted January 29, 2009 Share Posted January 29, 2009 Anyone know how to update the Registration page to warn users what the required field formatting requirements are? Specifically the Telephone field seems to cause issues requiring "numeric only". Folks in the united states tend to use (111) 222-3333, 111 / 222 3333, 111-222-3333 or similar delimiter type formatting that a human can parse. How can I help users register more smoothly as basically all are rejected on their first try? tia, g Quote Link to comment Share on other sites More sharing options...
Guest Posted January 29, 2009 Share Posted January 29, 2009 You can either edit the templates, the language variables which show up on the templates, or edit the PHP code so that the requirement does not exist, which is what I did on my site. in includes/content/reg.inc.php, find the section that looks like: if ($_POST['skipReg']==1 && (empty($_POST['firstName']) || empty($_POST['lastName']) || empty($_POST['email']) || empty($_POST['phone']) || empty($_POST['add_1']) || empty($_POST['town']) || empty($county) || empty($_POST['postcode']) || empty($_POST['country']))) { $errorMsg = $lang['reg']['fill_required']; } elseif(!isset($_POST['skipReg']) && (empty($_POST['firstName']) || empty($_POST['lastName']) || empty($_POST['email']) || empty($_POST['phone']) || empty($_POST['add_1']) || empty($_POST['town']) || empty($county) || empty($_POST['postcode']) || empty($_POST['country']) || empty($_POST['password']) || empty($_POST['passwordConf']))) { This section defines which fields are required. If you want to change the required fields, edit this to either add or remove fields from the list. Next, to change the format requirements of the phone and mobile phone fields, look for this code: } elseif(!preg_match('#^([0-9-\s]+)$#', $_POST['phone'])) { $errorMsg = $lang['reg']['enter_valid_tel']; } elseif(!empty($_POST['mobile']) && !preg_match('#^([0-9-\s]+)$#', $_POST['mobile'])) { $errorMsg = $lang['reg']['enter_valid_tel'];You can either edit this to your liking, or remove it completely, which is what I did. Quote Link to comment Share on other sites More sharing options...
grafis Posted January 30, 2009 Author Share Posted January 30, 2009 Thanks Alan, that gives me an excellent start. Not sure if I add notices (they should seriously be there by default), redesign the whole page or what. I'll give it a whirl Quote Link to comment Share on other sites More sharing options...
burgensteen Posted January 30, 2009 Share Posted January 30, 2009 You just need to add the () and - to the preg match so that they can be recognised along with the numeric values within the phone field. Quote Link to comment Share on other sites More sharing options...
Guest estelle Posted January 30, 2009 Share Posted January 30, 2009 What Burgensteen said. Plus, when adding the parentheses they may have to be escaped with backslashes (?). Try this: } elseif(!preg_match('#^([0-9-\s\(\)]+)$#', $_POST['phone'])) { $errorMsg = $lang['reg']['enter_valid_tel']; } elseif(!empty($_POST['mobile']) && !preg_match('#^([0-9-\s\(\)]+)$#', $_POST['mobile'])) { $errorMsg = $lang['reg']['enter_valid_tel']; 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.