Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
 All Forums
 Technical
 ASP (Windows server) versions
 Cart "full name" alert
Author « Topic »  

Dermontti
Advanced Member

USA
161 Posts

Posted - 06/10/2024 :  10:10:31  
Hello,

On cart step 2, we get the alert for a user not entering a full name in the name field.
Ex: "John" instead of "John Smith"

They can click the alert off, then hit the proceed button without updating the name.

Is there a way such as a variable we can use to prevent the user from moving to step 3 without the name properly entered?

Below seems to be the js responsible. When false is returned, what is it supposed to do?

If there is no variable to control this, could we adjust the js below to stop it?

<% if NOT usefirstlastname then %>
var regex=/ /;
if(checkaddress&&!checkedfullname&&!regex.test(frm.ordname.value)){
alert("<%=jscheck(xxFulNam&" """&xxName)%>\".");
frm.ordname.focus();
checkedfullname=true;
return(false);
}
<% end if %>
return true;
}

dbdave
ECT Moderator

USA
10379 Posts

Posted - 06/10/2024 :  12:52:53  
Hi, try this is you want to edit that, although you will need to do this with each edit.

<% if NOT usefirstlastname then %>
var regex=/ /;
if(checkaddress&&!checkedfullname&&!regex.test(frm.ordname.value)){
//alert("<%=jscheck(xxFulNam&" """&xxName)%>\"."); //line commented out
alert("You must enter your Full Name in the <%=xxName)%> Field"); //new line added
frm.ordname.focus();
//checkedfullname=true; //line commented out
return(false);
}
<% end if %>
return true;
}


I have not tested this, so be sure to run a few tests after you make the changes.

Thanks,
David

Edited by - dbdave on 06/10/2024 12:56:25

Dermontti
Advanced Member

USA
161 Posts

Posted - 06/11/2024 :  05:16:16  
Thanks!

It works, but I had to remove the ) from inside the ASP variable.

Dermontti
Advanced Member

USA
161 Posts

Posted - 06/11/2024 :  05:49:45  
Is there a way to make sure this also works for the shipping address?

The below is the html output of the shipping address full name in the browser.

<input type="text" name="sordname" class="cdform2fixw ecttextinput cdformname" maxlength="30" id="sordname" value="" placeholder="Full Name" aria-required="true">

Dermontti
Advanced Member

USA
161 Posts

Posted - 06/11/2024 :  08:47:29  
Nevermind, I figured out a way to have them both working, even with our logged in user radio customizations:

<% if NOT usefirstlastname then %>
var regex=/ /;
if(checkaddress&&!checkedfullname&&!regex.test(frm.ordname.value)){
alert("You must enter your Full Name in the <%=xxName%> Field");
frm.ordname.focus();
alsoCheckShippingName = true;
return(false);
}
var shipDiffElement = document.getElementById('shipdiff2');
if (shipDiffElement) {
shipDiffChecked = shipDiffElement.checked;
if (!regex.test(frm.sordname.value)) {
if (shipDiffChecked) {
alert("You must enter your Full Name in the <%=xxName%> Field");
frm.sordname.focus();
return false;
}
}
}

var addressRadioElement = document.getElementById('ALISSHP');
if (addressRadioElement) {
addressRadioChecked = addressRadioElement.checked;
var saddressspan2Visible = document.getElementById('saddressspan2');
if (saddressspan2Visible){
saddressspan2Visible = document.getElementById('saddressspan2').style.display !== 'none';
if (!regex.test(frm.sordname.value)) {
if (!addressRadioChecked) {
alert("You must enter your Full Name in the <%=xxName%> Field");
frm.sordname.focus();
return false;
}
}
}
}
<% end if %>
return true;
}
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.03 seconds. Snitz Forums 2000