1

I have a product with custom option using text field, I'd like a validation to it so that only letters is allow i.e. just like those "required field", alert message will pop up if your input it not accepted.

I have been looking around for hours to see where is the option-list located but with no luck.

asked Jan 13, 2015 at 8:15
2
  • I have not used this myself, but found this the other day. rocketweb.com/custom-option-validator - the code itself may give you some idea of where to look. Commented Jan 13, 2015 at 8:45
  • Thanks i tried the extension but it is not working for me, dunno why. Commented Jan 13, 2015 at 17:13

2 Answers 2

2

Finally i found the custom-option-text field is located at: ..\app\design\frontend\base\default\template\catalog\product\view\options\type\text.phtml

for the line

<input type="text" onchange="opConfig.reloadPrice()" id=.... $_option->getIsRequire() ? 'required-entry'..... 

I used "required-entry validate-alpha" to replace the default 'required-entry', now for all custom options with text field it allows alphabet only, hard coded. Hope this may help anyone in needed.

answered Jan 13, 2015 at 17:12
1
0

Magento does not natively support the ability to provide validation on custom options. What you can do is take a look at the following third party module, developed by RocketWeb:

Custom Option Validator

I can't specifically vouch for it as I haven't found the need to use this before. But it is free and seems to do what you're looking for - so give it a shot and give us some feedback.

A great article worth reading which will allow you to implement it yourself:

Mini Tutorial: Adding REGEX Validation to Custom Options

answered Jan 13, 2015 at 8:49

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.