| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | Mark Forums Read | User manuals | Login |
Make Text Option a Required Field | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
Make Text Option a Required Field
I have added a text box in my product options. I need to make the customer type something in the box before it's added to the cart.
In other words, we cannot process the order if the text box is blank for that product. Thanks
__________________
Shawn Bulle RedPup Productions X-Cart ver 4.0.13 |
|||||||||
#2
|
|||||||||
|
|||||||||
My own answer
So anyway, after no resopnses on the board I tried a million combinations of validation script until something worked.
Heres what I came up with so someone else doesn't have to go through the monkey business that I had to. Code:
Just replace po42 with po and the index of your product option. Replace the alert with whatever you would like to say.
__________________
Shawn Bulle RedPup Productions X-Cart ver 4.0.13 |
|||||||||
|
#3
|
|||||||
|
|||||||
Re: Make Text Option a Required Field
where do i insert this code?
|
|||||||
#4
|
|||||||
|
|||||||
Re: Make Text Option a Required Field
Thanks for posting this Tabasco addict
It works like a charm. ( using 4.1.11) I had been screwing around with the same problem for the last hour or so before I found your code. leorulz if you are still wondering where to put this code it goes in the product options section. When you are adding product options to your product at the bottom of the page you will see a box titled Validation script ( Javascript) put it there. best Scott V fotodog13 4.1.11 gold apache
__________________
scott v x cart version 4.1.8 (Unix) |
|||||||
#5
|
|||||||||
|
|||||||||
Re: Make Text Option a Required Field
something else that seems to work (4.2.x)
Code:
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25 X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many ∙∙ Experience: Somewhere beyond newbie ----------------------------------------------------------------------------------------------------------------------------------------- Looking for the best dutch language pack? 4.1.x - 4.6.x compatibel, native speaker translation! More info |
|||||||||
#6
|
|||||||||
|
|||||||||
Re: Make Text Option a Required Field
Ok, Thank you.
I did somethink like this before: var obj = product_option("Line1"); if(obj.value.length<1) { alert("'Line1' Length is '"+obj.value.length+"' Text Lines fields can not be empty''"); obj.focus(); return false; } return true; But we have hundreds of products what might require same validation of more then in text line. Some thing like: Line1, Line2, Line3... In additon if you try to add our product to shopping cart and them edit (in cart.php) page x-cart open pop-up and above validation script not working. Did anyone tried it before in cart.php page. thank you. Quote:
__________________
|
|||||||||
#7
|
|||||||
|
|||||||
Re: Make Text Option a Required Field
Thanks for posting tobasco-addict, very useful code!
Darren
__________________
Darren X-Cart Gold 4.3.1 |
|||||||
#8
|
|||||||
|
|||||||
Re: Make Text Option a Required Field
Anyone know how to show the required text field on the category product list? Even with validation on the field working properly, customers can add products without completing the text field as long as they don't go to the actual product page. Any solution or ideas would be appreciated!
P.S. How do I change my display name to something OTHER than my personal e-mail =\
__________________
X-Cart Gold 4.4.5 |
|||||||
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|