| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Validating Additional field in register.php | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() 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.
__________________
Xcart 4.3 |
|||||||
#2
|
|||||||||
|
|||||||||
![]() {literal} goes before <script> and {/literal} after </script>
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#3
|
|||||||
|
|||||||
![]() 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?
__________________
Xcart 4.3 |
|||||||
#4
|
|||||||||
|
|||||||||
![]() Insert it at the top in register.tpl
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#5
|
|||||||
|
|||||||
![]() 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?
__________________
Xcart 4.3 |
|||||||
![]() |
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|