Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding a Required Field


Guest

Recommended Posts

Ok,

Anyone know a quick way to make a form text field required? I added a phone number to my shipping page in the checkout process and I cannot find where I should add the javascript.

 

It would be similar to making say the comments field required in the checkout process. How would I do this? There is a thread in the forum but noone figured it out.

 

 

Here is my text area, taken from my checkout_shipping.php page:

 

<tr>

<td class="main">Contact Phone Number: (required)</td>

<td><?php echo tep_draw_input_field('sphone', '', 'sphone', '', 'text'); ?><td>

</tr>

 

 

 

 

Thanks for your time!

Link to comment
Share on other sites

open create_account.php and you have the whole method coded for you already. You need to add - on the page that is processing your input (in this case same file, lower php section in php part) - the form checks.

 

this is how it's done on create account

 

if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {

$error = true;

 

$messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);

}

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...