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

  • SEARCH
  • Home
  • 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 8336713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:04:52+00:00 2026-06-09T04:04:52+00:00

I have a default form for my specific view. Through an element I (dinamically)

  • 0

I have a default form for my specific view.

Through an element I (dinamically) include another view (using view extension) in order to provide an upload form.

My problem is that the second form seems to submit the first one.

Default form

<div class="content-box-content">
        <?php
            echo $this->Form->create("WebSubject", array(
                'inputDefaults' => array(
                    'error' => array(
                        'attributes' => array(
                            'wrap' => 'span', 
                            'class' => 'input-notification error png_bg'
                        )                   
                    )
                )
            ));
        ?>

        <?=$this->Form->input('id', array('type' => 'hidden'))?>

        <?=$this->Form->input('title', array('class' => "text-input small-input", 'label' => 'Denumire'))?>

        <?=$this->Form->input('description', array('type' => 'textarea', 'label' => 'Descriere', 'id' => 'description'))?>

        <?=$this->Form->input('description_long', array('type' => 'textarea', 'label' => 'Continut', 'id' => 'description_long'))?>

        <?=$this->Form->submit('Salveaza', array('class' => "button"))?>
    </div>

This way I include the element

<div class="tab-content default-tab" id="fotoUploadTab">
            <?php
                echo $this->element('file_upload_form', array(
                        'view' => 'upload_admin',
                        'webFileType' => 'image',
                        'redirect' => $SHT['here']
                    )
                );
            ?>
            <div class="tab-content default-tab">
                Lista imagini
            </div>
        </div>

Element code

<?php
    $view = (isset($view)) ? $view : "upload_admin";
    $webFileType = (isset($webFileType)) ? $webFileType : "image";
    $redirect = (isset($redirect)) ? $redirect : "/";
?>
<?php 
    $this->extend("/WebFiles/".$view);   
?>

Extended View code

<div class="tab-content default-tab">

    <?php echo $this->Form->create("WebFile", array('action' => '/', 'type' => 'file')); ?>

    <input type="hidden" name="redirect" value="" />
    <?php echo $this->Form->input('entity_id', array('type' => 'hidden')); ?>
    <?php echo $this->Form->input('entity_table_name', array('type' => 'hidden')); ?>
    <?php echo $this->Form->input('type', array('type' => 'hidden')); ?>

    <?php echo $this->Form->input('title', array('class' => "text-input small-input", 'label' => 'Denumire')); ?>   
    <?php echo $this->Form->input('description', array('class' => "text-input small-input", 'label' => 'Descriere')); ?>
    <?php echo $this->Form->submit('Upload', array('class' => 'button')); ?>

</div>

As seen in the last snippet, I tried to force the last form by providing an action url, but on submiting it, it sends data as the first one does.

How should I handle this ?

Thank you!

  • 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-09T04:04:53+00:00Added an answer on June 9, 2026 at 4:04 am

    If you just want to have both forms, the one from parent and the other from the child view/element make sure you call $this->Form->end() in both templates and that you are not nesting a form inside the other. Probably, in your case, just by adding end() to both forms will solve your issue.

    As a side note, you cannot have a parent view opening a Form with $this->Form->create() and inject fields into it using the child view, basically because you need create() to be called before any input is rendered and parent views are rendered after the child is executed.

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

Sidebar

Related Questions

C# question: I have a textBox in a default form Form1 and I want
I have an ASP.Net Page, aspx with its default form. I have a Submit
I have created a simple test form with FormBorderStyle = FixedToolWindow by default and
I have a form with 4 dropdowns on it. The default selected option in
I have a form with 3 select elements. Each one, by default, has option
I have a rails app with a mobile view using jqtouch. If the application
I have this form that is using data-defaults and I need to be sure
I have a WordPress site that I am using a gravity form. I would
My server have default php version of 4, so when I run some script
I want to be able to have default text like Enter content here... appear

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.