Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1111113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:29:50+00:00 2026-05-17T02:29:50+00:00

It’s true I’ve seen a lot of examples on stackoverflow and many from Google

  • 0

It’s true I’ve seen a lot of examples on stackoverflow and many from Google search but apparently nobody showed the big picture of how things falls under one another, even from the manual itself.

I’ve just picked Zend Framework(1.10.8) and when creating forms I’ve finally found that the ViewScript for now is much easier for me to configure but wasn’t the case.

I have amodule booking, with UserController and createAction in it.Under /application/modules/booking/views/scripts/user I have create.phtml and custormerForm.phtml.

From my understanding, at the end of everything my form with it’s rendering will be shown in my create.phtml as in my form will use the customerForm.phtml for it’s visual and injected in the create view.

So I went ahead and created a simple form

function init(){
  $this->setMethod("post");

  $name = New Zend_Form_Element_Text("name");
  $name->setLabel("Name: ")
  ->setOptions(array("size"=>"35"))
  ->setRequired(true)
  ->addValidator("NotEmpty", true);

  $surname = New Zend_Form_Element_Text("surname");
  $surname->setLabel("Surname: ")
  ->setOptions(array("size"=>"35"))
  ->setRequired(true)
  ->addValidator("Alpha", true);

  $this->addElement($name)
  ->addElement($surname)
  ->addElement($submit);
}

Now here is the createAction in UserController

public function createAction(){
  $this->view->show = "Please Enter your Details";

  $form = new Hotel_Form_Entity();
  $form->setAction("/booking/user/create");
                //and here set the for to be displayed at described in customerForm view
  $form->setDecorators(array(array('ViewScript',array('viewScript'=>'customerForm.phtml'))));
                //so here i set the form to form variable accessible in create view
  $this->view->form = $form;
  if($this->getRequest()->isPost()){
    if($form->isValid($this->getRequest()->getPost())){
      $values = $form->getValues();
      $this->_helper->flashMessenger("Thank you.Form processed");

      $this->_forward("success","user","booking",$values);
    }
  }
}

Now these are the create.phtml and customerForm.phtml

<!-- create.phtml -->
<h4><?php echo $this->show; ?></h4><br/><!--  -->
<p><?php echo $this->form; ?></p><br/> 

 <!-- customerForm.phtml --> 
<div style="padding: 10 0 0 15; border: solid 1.5px #999">
 <form action="<?php echo $this->element->getAction(); ?>" method="<?php echo $this->element->getMethod(); ?>">
  <table>
     <tr>
       <td><?php echo $this->element->name; ?></td>
       <td></td>
     </tr>
     <tr>
       <td></td>
       <td><?php echo $this->element->surname; ?></td>
     </tr>
     <tr>
       <td colspan="2"><?php echo $this->element->submit; ?> </td>
     </tr>
   </table>
  </form> 
 </div>

so when I hit my page as in http://localhost/project/booking/user/create
it just displays the layout with the content of the create view with no form. Nothing in page source, no errors.

Did I get the wrong idea on how to use this or I’m just doing something wrong in the code?And since i’m using Zend framework 1.10.8 there seems not to be any tutorial covering the whole thing on ViewScript decorator.

Can anyone please give me a hand and share his valuable experience here? Thank you very much for reading this. Maybe I’ll make this a tutorial who knows 😀

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:29:52+00:00Added an answer on May 17, 2026 at 2:29 am

    OK i’ve figured it out.Everything in coding side was correct.
    i just had to put the customerForm.phtml into /modules/booking/views/scripts/ and that’s it.thanks for those who tried to help me.I can now learn how to customize the standard decorators as Tawfekov tried to explain.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.