# Controller not called in a view (cake 3.5)\[Fixed\]

**URL:** <https://discourse.cakephp.org/t/controller-not-called-in-a-view-cake-3-5-fixed/4250>\
**Category:** Need Help\
**Created:** [May 2, 2018, 10:37am UTC](https://discourse.cakephp.org/t/controller-not-called-in-a-view-cake-3-5-fixed/4250 "2018-05-02T10:37:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sacha](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/sacha/32/1013_2.png) [@sacha](https://discourse.cakephp.org/u/sacha)\
**Post date:** [May 2, 2018, 10:37am UTC](https://discourse.cakephp.org/t/controller-not-called-in-a-view-cake-3-5-fixed/4250/1 "2018-05-02T10:37:51Z")

</div>

Hi,  
Since this morning I’m fighting that problem with might be obvious for everybody beside me.  
I made a mail change form and for whatever reason, its controller is never called…

```
        <form class="form-horizontal">

    <?php echo $this->Form->create(null, ['url' => ['controller' => 'Profiles', 'action' => 'changemail']]); ?>
	<div class="col-md-6">

	<fieldset>
		<div class="form-group">
			<label for="inputEmail" class="col-sm-2 control-label"> New Email</label>

			<div class="col-sm-10">
				<input type="email" class="form-control" id="inputEmail" placeholder="Email">
			</div>
		</div>
	</fieldset>

    <?php echo $this->Form->button(__('Submit')); ?>
    <?= $this->Form->end() ?>

	</div>
</form>

```

and the associated controller resumed to its simplest expression: (ProfilesController.php)  
public function changemail()  
{  
Debugger::dump(‘here…’);

```
}

```

I have no idea why it doesn’t work.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![jarekgol](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@jarekgol](https://discourse.cakephp.org/u/jarekgol)\
**Post date:** [May 3, 2018, 8:52am UTC](https://discourse.cakephp.org/t/controller-not-called-in-a-view-cake-3-5-fixed/4250/2 "2018-05-03T08:52:00Z")

</div>

1. look for html (page source in browser) and check if “url” created in -\>Form-\>create() is reasonable.
2. Call your action from address bar directly and check log/debug if it work that way.

---

<div class="post-metadata">

**Author:** ![sacha](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/sacha/32/1013_2.png) [@sacha](https://discourse.cakephp.org/u/sacha)\
**Post date:** [May 4, 2018, 2:06pm UTC](https://discourse.cakephp.org/t/controller-not-called-in-a-view-cake-3-5-fixed/4250/3 "2018-05-04T14:06:08Z")

</div>

sadly it works…

I’m using Adminlte template if it does matter and login, registrations forms are working as it should.  
It might be something trivial but I can’t wrap my head around it.

Thx

---

<div class="post-metadata">

**Author:** ![brent](https://avatars.discourse-cdn.com/v4/letter/b/ec9cab/32.png) [@brent](https://discourse.cakephp.org/u/brent)\
**Post date:** [May 5, 2018, 2:32am UTC](https://discourse.cakephp.org/t/controller-not-called-in-a-view-cake-3-5-fixed/4250/4 "2018-05-05T02:32:24Z")

</div>

sacha,

You have nested Form tags, which I believe is invalid HTML as the first form tag will be the active one. Once you remove the outside form tag your inner form will work.

I bet if you paste your browser rendered HTML source code on W3C’s HTML validator ([https://validator.w3.org/](https://validator.w3.org/)) this would report that along with a closing DIV problem.

---

<div class="post-metadata">

**Author:** ![sacha](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/sacha/32/1013_2.png) [@sacha](https://discourse.cakephp.org/u/sacha)\
**Post date:** [May 5, 2018, 4:51am UTC](https://discourse.cakephp.org/t/controller-not-called-in-a-view-cake-3-5-fixed/4250/5 "2018-05-05T04:51:25Z")

</div>

That was it!  
I overlooked at it for days and couldn’t see it !

thanks guys.

---

<div class="post-metadata">

**Author:** ![lafeber](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/lafeber/32/956_2.png) [@lafeber](https://discourse.cakephp.org/u/lafeber)\
**Post date:** [May 7, 2018, 7:00pm UTC](https://discourse.cakephp.org/t/controller-not-called-in-a-view-cake-3-5-fixed/4250/6 "2018-05-07T19:00:07Z")

</div>

Hi Sacha,  
Can you please update the title of this thread and add “[Solved]” at the end?  
Regards,  
Philip.
