Hi Paul. I have both mods working together with no problems. It's easy to do.
You first need to insert the following JavaScript function towards the top of your tpl_checkout_account_default.php file, so it looks like this..
Then for each component on the page which you want to validate, change to something like this (firstname used as example)..Code:<?php // Checkout Account Page Template // Mod Created by C.J.Pinder / Glint Systems Limited ( http://www.glintsystems.co.uk ) // Copyright 2003-2007 Zen Cart Development Team // Portions Copyright 2003 osCommerce // Released under the GNU Public License v2.0 ?> <div class="centerColumn" id="checkoutAcctDefault"> <h1 id="checkoutAcctDefaultHeading"><?php echo HEADING_TITLE; ?></h1> <p id="checkoutAcctDefaultInfo" class="biggerText"><?php echo TEXT_CHECKOUT_ACCOUNT_INFO; ?></p> <?php if ($messageStack->size('create_account') > 0) echo $messageStack->output('create_account'); ?> <?php echo zen_draw_form('create_account', zen_href_link(FILENAME_CHECKOUT_ACCOUNT, '', 'SSL'), 'post', 'onsubmit="return check_form(create_account);"') . zen_draw_hidden_field('action', 'process') . zen_draw_hidden_field('email_pref_html', 'email_format'); ?> <script type="text/javascript"> function capitalize(f,m) { if (m) /*cap words*/ { var temp, tempC, pre, post, strlen; temp = f.value.toLowerCase(); stringLen = temp.length; if (stringLen > 0) { for (i = 0; i < stringLen; i++) { if (i == 0) { tempC = temp.substring(0,1).toUpperCase(); post = temp.substring(1,stringLen); temp = tempC + post; } else { tempC = temp.substring(i,i+1); if (tempC == " " && i < (stringLen-1)) { tempC = temp.substring(i+1,i+2).toUpperCase(); pre = temp.substring(0,i+1); post = temp.substring(i+2,stringLen); temp = pre + tempC + post; } } } } } else /*cap all*/ { var temp = f.value.toUpperCase(); } f.value = temp; }; </script>
The same format above can be reapplied to lastname, streetaddress, suburb, city etcCode:<?php echo zen_draw_input_field('firstname', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_firstname', '40') . ' id="firstname" onchange="capitalize(this,1);"') . (zen_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="alert">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?>
The postcode is the only component which requires a different type of change..
That's it. I would have posted my whole file as an attachement but I have a few other mods added so it prob wouldn't have been much use. Hope that helps.Code:<?php echo zen_draw_input_field('postcode', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_postcode', '40') . ' id="postcode" onchange="capitalize(this,0);"') . (zen_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="alert">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?>


Reply With Quote
only thing I can't get to capitalise is the state field. I Don't use the dropdown box so people have to type in their County. I put the code in the same as for the other fields but it is the only part that doesnt work. It is on my wifes site 
thats strange I could have sworn it didnt before, must be my eyesight! 
