2009年3月23日星期一

[fw-mvc] rewrite routing, and Zend forms, oh my....

Folks,
I have a couple of different questions that I'm not easily finding an answer to in the docs, since the docs are oriented toward documenting specific items in the framework, and I'm trying to figure out how to put different things together as a solution, and lacking examples
 
1) How can I get the the framework to essentially show null in the browser address bar? For example, the user clicks a link, lets say "mysite.com/app/controller/action/param1/value". I want the address bar to actually look as if they are still at the root level of the app, namely "mysite.com/app". I know I can do this with redirects, but that would create other issues, like when I want a form to post back to itself. Redirecting to "/" would take them to a different page, obviously.
 
I'm sure the answer has something to do with the rewrite router, but I can't find the solution to this issue clearly documented in the docs.
 
2) Another issue I can't seem to find an answer to is how to validate a form based on data in the database. For example, suppose I want to have a registration page. With Zend_Form and it's validators, I can easily validate based on if the input is alpha numeric, etc. But the native validators don't seem to have functionality that can query the database to see if the name exists and generate a form validation error based on the results. I could obviously put constraints on the table to enforce unique entries, but that would just generate SQL errors. I want the form to show the user what the problem is when it posts back to itself.
 
Is the answer to create a custom Validator? If so, are there any examples of how to do this?
 
 
 
Regards,
Seth

没有评论: