Support the ongoing development of Laravel.io →
Input Views Forms

I have this view code (hello.php)

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.1/jquery.mobile-1.4.1.min.js"></script>
</head>
<body>

{{ Form::open(array('url' => 'test')) }}
{{ Form::text('email', 'example@gmail.com') }}
{{ Form::submit('hello!') }}

{{ Form::close() }}

</body>
</html>

this is my route code:

Route::get('/', function()
{
	return View::make('hello');
});

Route::get('test', function()
{
	return View::make('hello');
});

So the idea is that my submit button links back to my view to test if jquery mobile works with laravel.

The app works if i use:

{{ Form::open(array('url' => '/')) }}

Now it the form loops back to the same page. But does not if i do this in the form:

{{ Form::open(array('url' => 'test')) }}

Does anyone know why?

Last updated 3 years ago.
0

The default method for Form::open() is POST, not GET.
So, first try

Route::post('test', function() { ... });

or, alternatively

Form::open(array('url' => 'test', 'method' => 'get'))

PS: it's just amazing how unescaped html in this thread makes the entire forum a jQuery Mobile site, with ajax navigation and css stuff... too bad they're going to fix it! :)

Last updated 3 years ago.
0

popolla said:

The default method for Form::open() is POST, not GET.
So, first try

Route::post('test', function() { ... });

or, alternatively

Form::open(array('url' => 'test', 'method' => 'get'))

PS: it's just amazing how unescaped html in this thread makes the entire forum a jQuery Mobile site, with ajax navigation and css stuff... too bad they're going to fix it! :)

Last updated 3 years ago.
0

Haha yes it is funny. I thought the site kinda looked strange :P

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

JeffreyR jeffreyr Joined 11 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.