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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:46:37+00:00 2026-06-18T02:46:37+00:00

I have a requirement to load a form into a page dynamically, with the

  • 0

I have a requirement to load a form into a page dynamically, with the potential for multiple instances of this form. Validating and saving is not a problem, but I cannot seem to pass back the actual form content / mark-up from the Controller. When testing with simple values (id: 1) I can return the data successfully, but the actual form is always returned as undefined if the datatype is not set, or [Object object].

Controller:

public function addPermissionFormAction()
{
    $this->_helper->viewRenderer->setNoRender();
    $this->_helper->layout->disableLayout();
    //data from ajax call is successfully received
    $username = $this->getRequest()->getParam('user');
    //...Code to get $pages...
    $form = new Pds_Wizard_SubForm_Externals($pages);

    if(!isset($form)) $form = false;
    //I have run XDebug to here and confirmed that the form is built successfully.
    echo Zend_Json::encode(array('form' => $form));
}

My Ajax Call:

$('#get-player-permissions').click(function() {
    if($('#test-test').val().length > 0) {
        $.ajax({
        url: '/pds/external-user/add-permission-form',
        data: { user: $('#test-test').val() },
        dataType: 'json',
        contentType: "application/json",
        success: function(data){
            alert(data.form); // [Object object]
            $("#wizardContainer").html(data.form); //empty, no form content
        }
    })
    } 
});

I have tried this without even adding the dataType or contentType fields for sending simple values, and have no issue getting those through. With the form, however, I will get a null or undefined in this case.

Any advice is appreciated, including more ideal methods of dynamically loading a form. I do not use Ajax calls very often, so if this is a simple mistake I apologize. Thank you in advance!

  • 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-06-18T02:46:39+00:00Added an answer on June 18, 2026 at 2:46 am

    You can’t set “no render” in this case. You need to have a view “add-permission-form.phtml” (or another view specified) to format and display the HTML code

    Controller :

    public function addPermissionFormAction()
    {
        $this->_helper->layout->disableLayout();
    
        //data from ajax call is successfully received
        $username = $this->getRequest()->getParam('user');
        //...Code to get $pages...
        $form = new Pds_Wizard_SubForm_Externals($pages);
    
        if(!isset($form)) $form = false;
        //I have run XDebug to here and confirmed that the form is built successfully.
        echo Zend_Json::encode(array('form' => $form));
    
        //Assign the form to a variable view
        $this->view->form = $form;
    }
    

    View : add-permission-form.phtml :

    <?php echo $this->form ;?>
    

    Ajax call :

    No comment, your code look cool

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

Sidebar

Related Questions

I have a requirement for load the html dynamically into div container, this div
I have a requirement to load a complex object called Node ...well its not
We have a requirement that a user can load any standard image into a
I have a requirement to have multiple iframes on one page, that all interact
i have a requirement to show javascript Ok/Cancel option on page load. So, when
I have requirement where some times I would like to load children as well
I have requirement to disable copy/paste/cut operations on a textbox. For this purpose I
For my ipad application i have requirement like this For each row in root
I have a requirement to allow users to change their passwords via a form
I have a requirement where i want to load pdf document in a web

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.