0

I create a from statically in HTML file in view project which is inside the module visit. I want the controller to handle the request occur when submitting the form

 <form action="addVisit" method="post">
      <input type="text" name="number"/>
 <input type="submit" name="save"/>

The structure of the project is

module visits

controller Visits and it has action addVisit

when submitting the form an error occur, the url becomes like this when submitting the form

http://localhost/zendApps/InspectionSys/public/visits/visits/VisitsController/addVisit

in the controller there is a function action

 public function addVisitAction()
{
            echo 'here';
}

what should I do ?

1
  • What happened with your last question? Haven't you fixed the route? Commented Mar 4, 2012 at 7:51

1 Answer 1

1

First you might reconsider camel caseing your actions addVisitAction() because if you do then you have to deal with view file names like add-visit.phtml I think it will affect urls as well, I find it simpler just to leave action names as lowercase addvisitAction(), this might be part of what's amiss.

Next identify your form actions as /module/controller/action (if you are not using modules you can omit that param), so your action should at least be /visits/visits/addvisit or /visits/visits/add-visit (not quite sure which will work properly) .

also when using html forms that were not generated by Zend_Form you can access the values using $this->getParams() or $this->getParam('paramName') instead of $this->getValues().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.