I need to add some form validation for telephone field on admin side for magento. I am looking for correct file to work on
There's already some validation for required fields on the admin sales_order_create
I am trying to find the right file that I can work on for the page sales_order_create
. I did some search but still I had no luck on my code base.
Best Answer
To add form validation, you'll have to create the file to work on, and hook it to the Magento layout.
Add JavaScript to Sales Order Create
To follow best practices, you'll have to create your own module if you don't have already. I'll start from bottom up, to evidentiate the core need:
Create a layout file
app/design/adminhtml/default/default/layout/mycustom/adminthml.xml
You can skip the mycustom folder if you'd like and name your js file as you want - but remember to change accordingly also in the next steps.
Now you need to reference the xml layout file you just created.
Create your module
Create
app\code\local\Mycustom\Adminhtml\etc\config.xml
Again, you can also skip the folder and name the xml file as you want.
Now you need to reference your module. Create
\app\etc\modules\Mycustom_Adminhtml.xml
Now you can create your Javascript file
\js\mycustom\mycustom.js
and put your validation code in it. For JS form validations you can check this answers: Custom form Validation - MagentoWhat to be aware of/check:
More detailed version here: Add JS to Magento Sales Order