![]() |
Validating Additional field in register.php
Hi,
I am trying to validate an additional field in the modify profile and the create profile page. I am using this script: <script type="text/javascript"> {literal} var PhoneObj = document.getElementById('additional_values_2'); if (PhoneObj.length!=10 ) { alert('Please enter a phone number that is 10 digits long with no dashes "-".'); return false; } else return true; {/literal} </script> but, everywhere that I place the code it does nothing. I need to make sure that the member inputs a phone number that has no "-" in it and is only 10 digits long. Thanks for the help. |
Re: Validating Additional field in register.php
{literal} goes before <script> and {/literal} after </script>
|
Re: Validating Additional field in register.php
I've changed the placement of the {literal} and {/literal} but I don't know where to place the code in the register.tpl. Should I put the code in the register_additional_info.tpl?
|
Re: Validating Additional field in register.php
Insert it at the top in register.tpl
|
Re: Validating Additional field in register.php
I have now changed my code to this:
<script type="text/javascript" src="/skin1/customer/popup_open.js"></script><script type="text/javascript" src="/skin1/main/popup_image.js"></script><script type="text/javascript"><!--var PhoneObj = document.getElementById('additional_values_2');if (PhoneObj.length!=10 ){ alert('Please enter a phone number that is 10 digits long with no dashes "-".'); return false;}else return true;--></script> I have moved the script to the suggested position in skin1/customer/main/register.tpl but it is still not validating the field. I have reviewed the code for the product.php page that uses javascript to validate the product options and there is one difference. The field I want to validate is this: <input type="text" name="additional_values[2]" id="additional_values_2" size="32" value="05135559999" /> and the code from the product page has this: <select id="po3" name="product_options[3]" onchange="javascript: check_options();"> How do I get the onchange="javascript: check_options(); into the register.tpl or register_additional_info.tpl? |
All times are GMT -8. The time now is 09:39 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.