Form tag is stripped off in Cake Php - forms

Form tag is stripped off in Cake Php view file.
In 'login.ctp' (Layout view)
<div id="test">
<?php echo $this->Form->create(); ?>
Test form Elements
<?php echo $this->Form->end(); ?>
</div>
When checked in firebug console only creating below tags
<div id="test">
<div style="display:none;"><input type="hidden" value="POST" name="_method"></div>
Test form Elements
</div>
// "<div style="display:none;"><input type="hidden" value="POST" name="_method"></div>". This div tag is automatically created.
I also created a 'inner.ctp' on elements in views and tried to call from layout view(login.ctp) as echo $this->element('inner') , but results in same problem
Can any one help?

I'm almost certain that you have another form on your page, probably in your layout, that you're not closing with...
echo $this->Form->end();
If this is not the case, I suggest getting the latest stable version of Cake 1.3 and overwriting your current one.

Related

Posting from form on Razor Page returns blank page

If I create a form using form tag helper the submit button triggers the OnPost event
<form method="post" asp-page="login">
However if I use
<form method="post" action="/auth/login">
The OnPost event is not fired.
And yes, asp-page="login" translates tp "/auth/login".
Even if I use asp-page="login" and copy the url from the console inspector and paste onto my cshtml page, a blank page is returned.
Any thoughts?
You can try to add #Html.AntiForgeryToken() into the second form.When you use the second form,it will lose a hidden input which contains the antiforgery token.
<form method="post" action="/auth/login">
#Html.AntiForgeryToken()
<input type="submit" value="submit" />
</form>

Why is there a form in a Wicket modal window?

When I look at the HTML of a Wicket modal window, I see a form. Why is it there?
ModalWindow's JavaScript generates a <form> to support the following use-case:
+ Page
+ Form("f")
+ TextField("a")
+ ModalWindow("m")
+ Form("f2")
+ TextField("b")
When rendered in the browser, the nested form "f2" is rendered as a <div> - this is something Wicket does for you because nested forms are not valid HTML.
When opened, ModalWindow removes its containing markup and puts it into a <div> added to the document body:
<form wicket:id="f">
<input wicket:id="a" />
<div wicket:id="m">
<!-- markup removed -->
</div>
</form>
<div>
<form> <!-- generated form -->
<div wicket:id="f2">
<input wicket:id="b" />
</div>
</form>
</div>
Without the generated form the inputs inside the modal window could not be submitted via Ajax.
Note that this has a naughty implication:
Even when you just want to use a form inside the modal window, you still have to have a form wrapping the modal window.
Without it:
+ Page
# wrong - no wrapping form
+ ModalWindow("m")
+ Form("f2")
+ TextField("b")
... "f2" would stay a <form> and the result would invalid HTML with two nested forms:
<div wicket:id="m">
<!-- markup removed -->
</div>
<div>
<form> <!-- generated form -->
<form wicket:id="f2">
<input wicket:id="b" />
</form>
</form>
</div>

Genemu autocomplete won't work

I'm trying to use genemu autocomplete to display a list of entities. I followed every step, but for some reason, it doesn't work : all I got is a text input, and nothing shows up when I type something inside.
So far, my build looks like this :
->add('departure', 'genemu_jqueryautocompleter_entity', array(
'class' => 'AOFVH\FlyBundle\Entity\City',
'property' => 'name',
))
Twig template looks like this :
<form id="msform" class="form-inline" role="form" method="post" {{ form_enctype(search) }}>
<!-- progressbar -->
<div class="form-group">
{{form_widget(search.departure)}}
</div>
<div class="form-group">
{{form_widget(search.arrival)}}
</div>
<hr>
<div class="form-group">
{{form_widget(search.passengers)}}
</div>
<div class="form-group">
{{form_widget(search.precisedate)}}
</div>
<hr>
<button type="submit" class="btn btn-default hp3">CHERCHER</button>
</form>
And I included jquery and jquery-ui. What did I miss ?
Most of these bundles comes with javascript and css of their own. Did you included them? I believe that you use GenemuFormBundle? If that is correct, there is paragraph for that as well:
You use GenemuFormBundle and you seen that it does not work! Maybe you have forgotten form_javascript or form_stylesheet.
The principle is to separate the javascript, stylesheet and html. This allows better integration of web pages.
Take a look at their example page: Docs.

Magento include phtml file within another phtml file

I am making a custom home page for my magento website in a phtml file named home_banner.phtml, which in turn i have referenced in the CMS->Pages->Home Page content by the following code
{{block type="core/template" template="theme/home_banner.phtml"}}
In my home_banner.phtml I have called tags/popular.phtml to display the popular tags.
<div class="last-posts-grid clearfix">
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('tag/popular.phtml')->toHtml(); ?>
</div>
However the tags are not being displayed even though the anchor tag which says "view all tags" id getting called correctly. The ul class="tags-list" is also visible in the page source but the tags themselves are not visible. Any suggestions?
You made a small mistake in the template file. Your template file has to be as below:
<div class="last-posts-grid clearfix">
<?php echo $this->getLayout()->createBlock('tag/popular')->setTemplate('tag/popular.phtml')->toHtml(); ?>
</div>
I tested this and its working fine.. Hope this helps..

How to use Assets in Moduls in fuelphp

I created one view called myview.php in my modul(Named adminpanel)
path(adminpanel\views\myview.php) in that I use following code but Assets are not load
<?php
use Fuel\Core\Asset;
use Fuel\Core\Session;
?>
<html>
<head><title>Admin Panel</title>
<?php Asset::js(array('jquery.js','test.js'));?>
</head>
<body>
<?php echo Session::get('my');?>
<input type="button" value="Call Designer Controller" >
</body>
here test.js and jquery.js are not work properly and I donot get any error in my browser
Asset::js() returns the HTML required to load the assets as a string.
If you don't ECHO it, nothing will happen.