Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Validating Additional field in register.php

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-29-2010, 04:11 AM
 
Woodrow81 Woodrow81 is offline
 

Newbie
  
Join Date: Dec 2009
Posts: 7
 

Default 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.
__________________
Xcart 4.3
Reply With Quote
  #2  
Old 01-29-2010, 04:12 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: Validating Additional field in register.php

{literal} goes before <script> and {/literal} after </script>
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 01-29-2010, 04:48 AM
 
Woodrow81 Woodrow81 is offline
 

Newbie
  
Join Date: Dec 2009
Posts: 7
 

Default 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?
__________________
Xcart 4.3
Reply With Quote
  #4  
Old 01-29-2010, 01:48 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default Re: Validating Additional field in register.php

Insert it at the top in register.tpl
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 01-31-2010, 05:09 AM
 
Woodrow81 Woodrow81 is offline
 

Newbie
  
Join Date: Dec 2009
Posts: 7
 

Default 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?
__________________
Xcart 4.3
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:37 PM.

   

 
X-Cart forums © 2001-2020