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 6941369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:52:36+00:00 2026-05-27T12:52:36+00:00

I have a form with some text fields and I have a preview button

  • 0

I have a form with some text fields and I have a preview button that needs to submit the form to the same controller. And then in the controller, I need to extract the values and populate a form with these values for the template to see. What is the best way to achieve this? I’m a newbe so please be clear.

  • 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-27T12:52:37+00:00Added an answer on May 27, 2026 at 12:52 pm

    Sample controller:

    public function myControllerName(sfWebRequest $request)
    {
      $this->form = new myFormClass();
    }
    

    Use <?php echo $form->renderFormTag( url_for('@yourRoutingName'), array('method' => 'POST') ); ?> in your template and change @yourRoutingName to the one pointing to your controller.

    Now change your controller to be something like this:

    public function myControllerName(sfWebRequest $request)
    {
      $this->form = new myFormClass();
    
      if ($request->isMethod(sfRequest::POST)
      {
        $this->form->bind( $request->getParameter( $this->form->getName() ) );
    
        // Check if the form is valid.
        if ($this->form->isValid())
        {
          $this->form->save();
          // More logic here.
        }
      }
    }
    

    The $this->form->bind( $request->getParameter( $this->form->getName() ) ); part binds posted data to your form where $this->form->isValid() returns a boolean whether the form is valid or not.

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

Sidebar

Related Questions

I have Access Form with some Text fields and one Button. Is there any
I have a form with some fields like text , select etc. I need
The fields in my form have a label, some help text, some example text,
I have a form with some fields of type text and 2 fields (name
I have a wicket form containing a FileUploadField and some more text fields. When
I have a form with some select lists that will show/hide more input fields
I have a simple contact form on a website that has 2 text fields,
I have an html-form with several text fields. When I try to submit not
I have a form on which some text fields and two buttons are displayed.
Using ASP.NET VB, I have a form with some text boxes and a Gridview.

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.