I have multiple select and 2 text fields for advance multiple search in Magento eshop. The text field 1 has the value "Price Low" and the 2nd "Price High".
I want to disable the submit button until the user fills in only with numbers in the text fields, whose IDs are: "searchbar
" and "searchbar2
".
My problem is that if nothing is filled in the text field and the user submits the data, it will query "Price Low" & "Price High" text fields in the result and it will mess with the ot开发者_如何学运维her values ("brand
" etc).
Magento forms already use Really Easy Field Validation for Javascript so all you need to do is give those fields a class="required validate-number"
and the rest is automatic.
However on the server side you should must validate all fields yourself if not for better searching then for security reasons. Remember the programmer's mantra; Garbage In, Garbage Out!
精彩评论