mercredi 16 mars 2016

Data passing with Laravel 5.0 and select 2

Following tutorials on laravel 5 fundamentals, I am studying laravel 5.0. I am adding an original feature to the blog project shown on the tutorials.

I would like to go to the page that edits the article that I select by putting the id of the article to url. However, I don't know what I am supposed to do. Has anyone dealt with a similar problem before?

        $('#title').select2({
            placeholder: 'choose an article',
            maximumSelectionLength: 1,
            tag: true
        });


        $('#article-form').on('submit', function(e){
            e.preventDefault();
            var title = $('#title').val();
            $(this).attr('action', 'articles/'+ title).submit();
        }); 
    });
</script>


<h1>Articles</h1>
 {!! Form::model($article, ['method' => 'GET', 'id' => 'article-form', 'url' => 'articles/'.$article->id]) !!}

<div class = "form-group">
    {!! Form:: label('title', 'Title: ') !!}
    {!! Form:: select('title[]', $title, null, ['id' => 'title', 'class' => 'form-control', 'multiple']) !!}
</div>
<button type="submit" class="btn btn-primary form-control">show the content</button>
{!! Form::close() !!}

<hr/>

This is my route

 Route::resource('articles', 'ArticlesController');

Display error



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire