dimanche 27 décembre 2015

Div elements out side the form element, Laravel 5.2 Form Helper

I cant see if I am missing a div, or what I am doing wrong. I have no absolute or even relative positioning that might cause this

So the Modal looks like:

<div class="modal fade" id="{{ 'editPost' . removeSpaces($post->title) }}" tabindex="-1" role="dialog" aria-labelledby="{{ 'editPost' . removeSpaces($post->title) }}">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="editPost">Edit {{ $post->title }}</h4>
            </div>
            <div class="modal-body">
                @include('blog.posts.edit', ['postToEdit' => $post])
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

Ok so we have an include everything looks fine so far ...

{{ Form::open(array('url' => array('edit-post', $postToEdit->title), 'class' => 'form-horizontal')) }}
    <div class="form-group">
        {{ Form::label('title', 'Post Title', array('class' => 'col-sm-2 control-label')) }}
        <div class="col-sm-10">
            {{ Form::text('title', $postToEdit->title, array('placeholder' => 'sample title', 'class' => 'form-control')) }}
        </div>
    </div>
    <div class="form-group">
        {{ Form::label('content', 'Post Content', array('class' => 'col-sm-2 control-label')) }}
        <div class="col-sm-10">
            {{ Form::textarea('content', convertToMarkdown($postToEdit->content), array('placeholder' => 'some content', 'class' => 'form-control')) }}
        </div>
    </div>
    <div class="form-group">
        {{ Form::label('tags', 'Post Tags', array('class' => 'col-sm-2 control-label')) }}
        <div class="col-sm-10">
            {{ Form::text('tags', '', array('class' => 'form-control', 'data-role' => 'tagsinput')) }}
        </div>
    </div>
    <div class="form-group">
        {{ Form::label('categories', 'Post Categories', array('class' => 'col-sm-2 control-label')) }}
        <div class="col-sm-10">
            {{ Form::text('categories', '', array('class' => 'form-control', 'data-role' => 'tagsinput')) }}
        </div>
    </div>

    {{ Form::hidden('blogId', $blog->id) }}

    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            {{ Form::submit('Create', array('class' => 'btn btn-primary')) }}
        </div>
    </div>
{{ Form::close() }}

This is where the issues come in. All of those form-group divs are out side the form tag. Theres no css, aside from the default bootstrap css that would cause the following:

[Image[1]

What would be causing this

I have tried looking at the computed properties for the form, and its elements nothing stands out. Again there is no absolute positioning. This is all standard bootstrap jazz.

Even when I remove all the tags in the form element and put hello world inside, that still appears out side the form ... even <form> hello world</form> shows hello world out side the form tag



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire