Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Going Crazy Required field in checkout


jwhysleep

Recommended Posts

Posted

i put a required field in the checkout_shipping.php i have put the code into the top and also have the code in the form_check.js.php

no ,atter what when i click on continue it still goes to the next page even though i havnt typed anything into the field!

 

 

Im using the contribution "Customer required fields"

need this done im stuck

 

 

heres the code!

///////////////////////////////////this displays the field on the page////

 

<?php echo tep_get_extra_fields($cInfo->customers_id,$languages_id)?>

 

 

///////////////////////////top of page

 

tep_db_query("delete from " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id=" . $customer_id);

$extra_fields_query = tep_db_query("select ce.fields_id from " . TABLE_EXTRA_FIELDS . " ce where ce.fields_status=1 ");

while($extra_fields = tep_db_fetch_array($extra_fields_query)){

$sql_data_array = array('customers_id' => $customer_id,

'fields_id' => $extra_fields['fields_id'],

'value' => $HTTP_POST_VARS['fields_' . $extra_fields['fields_id']]);

tep_db_perform(TABLE_CUSTOMERS_TO_EXTRA_FIELDS, $sql_data_array);

}

 

/////////////////////////////////////////////////

 

////////////////////at top

 

require('includes/form_check.js.php');

 

////////////////

 

///////////////////////////////////////////// form_check.js.php

 

<?php

$extra_fields_query = tep_db_query("select ce.fields_id, ce.fields_input_type, ce.fields_required_status, cei.fields_name, ce.fields_status, ce.fields_input_type, ce.fields_size from " . TABLE_EXTRA_FIELDS . " ce, " . TABLE_EXTRA_FIELDS_INFO . " cei where ce.fields_status=1 and ce.fields_required_status=1 and cei.fields_id=ce.fields_id and cei.languages_id =" . $languages_id);

while($extra_fields = tep_db_fetch_array($extra_fields_query)){

$string_error=sprintf(ENTRY_EXTRA_FIELDS_ERROR,$extra_fields['fields_name'],$extra_fields['fields_size']);?>

check_input("<?php echo 'fields_' . $extra_fields['fields_id']?>", <?php echo $extra_fields['fields_size']-1;?>, "<?php echo $string_error; ?>");

<?php }?>

/////////////////////////////////////////

 

 

I have even tried other code javascript and php required fields and it still continues to go to the next page but this needs to be mandatory before going to the next step!

Posted

Can I use something simular to this

 

<?php

if (!isset($_POST['customers_id'])){

echo tep_get_extra_fields($cInfo->customers_id,$languages_id);

} else {

//it was filled out

}

 

?>

Archived

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

×
×
  • Create New...