Click to See Complete Forum and Search --> : First False after Submit
digitalmarks
05-11-2006, 11:52 AM
When I click ths submit button I get an error window that says First False Heres the code that has first false. Also what do I put in the place of
ENTRY HERE:
function orderSubmit(type)
{
if (type == 'order')
{if ( ! ( (document.order.order_type.checked) ||
checkRequired() ))
{ // checkCardNumber(); ENTRY HERE
alert('first true');
document.order.form_action.value = type;
document.order.submit();
return true;
}
else {
alert('first false');
return false;
}
}
Help,
Adam
phpnovice
05-11-2006, 10:29 PM
Seems you neglected to post the entire function -- because you were missing one closing brace. The following is what your function, correctly formatted, would look like.
function orderSubmit(type)
{
if (type == 'order')
{
if( ! (document.order.order_type.checked || checkRequired()) )
{
// checkCardNumber(); ENTRY HERE
alert('first true');
document.order.form_action.value = type;
document.order.submit();
return true;
}
else {
alert('first false');
return false;
}
}
}
Otherwise, I can't answer any of your questions without a better explanation of what this is supposed to do for you. In addition to that, I can't even tell what the function is doing without some idea of how the function is called.
digitalmarks
05-12-2006, 12:29 PM
Heres the full Script. I am tring to make a shopping cart and this script is from the order.html page. I got the shopping cart script from HTMLGoodies.com 'So you want a shopping Cart' Tutorial. After pressing the Sumbit Button I get a First False Dialog Box, Help!
<script LANGUAGE="javascript">
index = 0;
function format(val, post)
{
var decpoint;
var begin;
var end;
var valstr;
var temp_char;
valstr = "" + val;
//alert('valstr = ' + valstr);
decpoint = valstr.indexOf(".")
if (decpoint != -1) {
//alert('decpoint = ' + decpoint);
begin = valstr.substring(0,decpoint);
end = valstr.substring(decpoint+1,valstr.length);
//alert('begin = ' + begin + '\nend= ' + end);
}
else {
begin = valstr;
end = "";
}
if (end.length < post)
{while (end.length < post)
{
end += "0";
}
}
end = end.substring(0,post);
//alert('begin = ' + begin + '\nend= ' + end);
return (begin+"."+end);
}
function orderSubmit(type)
{
if (type == 'order')
{if ( ! ( (document.order.order_type.checked) ||
checkRequired() ))
{ // checkCardNumber(); ENTRY HERE
alert('first true');
document.order.form_action.value = type;
document.order.submit();
return true;
}
else {
alert('first false');
return false;
}
}
}
var infowin = null;
function copyToShipping() {
if (document.order.same_flag.checked) {
document.order.ship_name.value = document.order.name_first.value+' '+document.order.name_last.value;
document.order.ship_address1.value = document.order.address1.value;
document.order.ship_address2.value = document.order.address2.value;
document.order.ship_city.value = document.order.city.value;
document.order.ship_state.value = document.order.state.value;
document.order.ship_zip.value = document.order.zip.value;
document.order.ship_country.value = document.order.country.value;
document.order.ship_phone.value = document.order.phone.value;
}
}
function disableSameFlag() {
document.order.same_flag.checked = false;
}
function checkRequired() {
if (!document.order.name_first.value.length ||
!document.order.name_last.value.length ||
!document.order.email.value.length ||
!document.order.address1.value.length ||
!document.order.city.value.length ||
!document.order.state.value.length ||
!document.order.zip.value.length ||
!document.order.country.value.length ||
!document.order.ship_name.value.length ||
!document.order.ship_address1.value.length ||
!document.order.ship_city.value.length ||
!document.order.ship_state.value.length ||
!document.order.ship_zip.value.length ||
!document.order.ship_country.value.length) {
alert('You have not completed all required fields:\n' +
'Please complete the Name, Address, City,\n' +
'County, Post Code, and Country in both the\n' +
'Customer Info and Shipping Address sections');
return true;
}
else {
return false;
}
}
<!-- -->
</script>
Thanks,
Adam
phpnovice
05-12-2006, 12:44 PM
I'm sorry, but that still doesn't answer my questions. You posted script, but none of that script is calling the original function posted. Although I would need to see your HTML in order to tell you more, it doesn't help to keep posting source -- which I don't wish to paw through. If you want further help, you better psot a live like to your page on the Internet so that I can see it in action. Even then, you'll have to tell me what you are inputing to the form before submitting.
digitalmarks
05-12-2006, 12:48 PM
I am going to regroup and make the links and get bet with you later.
thanks for the Help,
Adam