determines the controller & action through the URL. You could write a
custom router that would interpret URLs like
mysite.com/app?action=someAction&controller=someController but I don't think
that's what you're after.
Custom validators are the way forward:
http://framework.zend.com/manual/en/zend.validate.writing_validators.html
Brenton Alker-3 wrote:
>
> Seth Atkins wrote:
>> 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.
>
> I'm not sure you can do this, with or without ZF (also don't know why
> you would want to). Other than either doing all your routing based on
> cookies or session data instead of the url (yuck), or fetching all
> content via Ajax. But maybe I'm misunderstanding, have you got an
> example of a page that does this?
>
>> 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?
>
> Yes, custom validators are the way to go.
>
>> Regards,
>> Seth
>
>
> --
>
> Brenton Alker
> PHP Developer - Brisbane, Australia
>
> http://blog.tekerson.com/
>
>
>
>
--
View this message in context: http://www.nabble.com/rewrite-routing%2C-and-Zend-forms%2C-oh-my....-tp22667776p22677291.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论