EDIT: I just found out, that the error is generated from my jquery.mobile-1.1.2.min.js. I don't know why and I don't know how to fix it yet, but I thought, that I just should you guys know.
For some reason, I can't submit. Please help.
These are my routes:
Route::get('forms/{unit_id}/{qr_id}', 'FormController@index');
Route::resource('units.qr.score', 'ScoreController');
And these are my Controller:
FormController:
public function index($unit_id, $qr_id)
{
//
return View::make('form.index')
->with('unit_id', $unit_id)
->with('qr_id', $qr_id);
}
ScoreController:
public function index()
{
//
return '<h1>Yeeeeeas?!</h1>';
}
**// EDIT: Changed show to store**
public function store($unit_id, $qr_id)
{
//
return $unit_id;
}
And this is my View:
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.2/jquery.mobile-1.1.2.min.css" />
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.2/jquery.mobile-1.1.2.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Title rockt</h1>
</div><!-- /header -->
<div data-role="content">
<p>Hello world</p>
{{Form::open(array('route' => array('units.qr.score.store', $unit_id, $qr_id)))}}
{{Form::label('rating1')}}
{{Form::input('range', 'rating1', 50, array('min' => '0', 'max' => '100', 'data-highlight' => 'true', 'id' => 'rating1', 'placeholder' => 'What the fuck?'))}}
{{Form::label('Test1')}}
{{Form::text('Test1')}}
{{Form::submit('Submit')}}
{{Form::close()}}
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>
So, I don't know why when I push the Submit button, I just get the message "undefined". If I reload it returns the correct value from my ScoreController.
Here is a screenshot: http://imgur.com/NVtuwUa.jpg
And help would be appreciated.
Thx and much Love,
George
You need to return a complete jQuery Mobile page.
Related questions:
Store shouldn't have parameters. Use Input::get('unit_id','unit id empty'); It's Posted.
Edit: And put the unit id etc as hidden inputs..
In accordance to what decker wrote correctly, the solution is to insert the following parameter to every link and submit button:
data-ajax="false"
Like this:
{{Form::open(array('url' => 'whatever', 'method' => 'POST', 'data-ajax' => 'false'))}}
Or like this:
{{link_to('whatever', 'whatever', array('data-ajax' => 'false'))}}
Here another resource:
jQuery Mobile links not working without data-ajax="false", why?