Could you help me find a way to solve my problem please?
I have 4 textbox fields : number
, key
, firstname
and name
.
When I tabulate from the number field after filling it, I would like to check in my database if this number exists.
If so, my application should select the name and firstname linked to the number (in my database) and fill in the other fields name and firstname and then disable these fields.
I think that I should use ajax but i don't know how to use ajax and Zend to achieve it.
I searched the web and I found a few tutorial that I don't understand.
Please could you give me a step by step way to do it?
Thanks
Just general brushstrokes:
Zend_Form
.checkNumberExistsAction()
that performs your db lookup. Return JSON formatted info containing the results of your check.One thing to remember: Do not depend solely upon this client-side processing to prevent the submission of disabled fields. Users can disable scripts on the client-side, so be sure to have server-side validation in place, as well.
i fully agree to @David approach and to commemorate the same, posts this skeleton code:
sampleview.phtml
IndexController.php
Modelsampleview.php