- This topic has 4 replies, 2 voices, and was last updated 10 years, 10 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.
Support site for Tips and Tricks HQ premium products
by
Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › Is there a way to validate customer input?
Tagged: collect customer input
I don’t have a very sophisticated upgrade regime; I have offered users with a current license code to upgrade for a reduced price. However the program will not be able to validate if a current version exists.
I would like to use the ‘collect customer input’ field to have the user input the old code before I give them the new one. I have read up on how to make the field mandatory – my question is is there a way to validate the input before going to Paypal?
The collect customer input field is just a free form text field. Different users use that field for different purpose so we can’t apply a validation that works for everyone. If you have some specific validation that you want to apply to your site then we will have to do a custom job.
I understand, I was looking more for a ‘has anyone done this’ sorta thing, or ‘are there any hooks’.
I made the change to requite customer input:
if (val.length != 0)
{
val = val.replace(“(“,”[“);
val = val.replace(“)”,”]”);
val_combo = val_combo + ” (” + val + “)”;
<validate here?>
} else {
alert(“Please include your v1 License key”);
return false;
}
Is my requirement met simply by adding a database query to validate the input and return false if its not valid?
Yep. The above code is in JavaSript though so to do the database query you will need to use AJAX there.