Code Monkey home page Code Monkey logo

Comments (6)

Anahkiasen avatar Anahkiasen commented on May 30, 2024

Can you post the generated HTML ? I'm not sure opening the form before the modal is cool with Bootstrap

from former.

 avatar commented on May 30, 2024

The generate Code ist complete without Bootstrap. Only a Label with wrong Label name and the Input field, but sorry i have at this moment no correct html output

from former.

Anahkiasen avatar Anahkiasen commented on May 30, 2024

Wait actually, I don't think there are labels in vertical forms in Bootstrap, try with horizontal_open.

from former.

 avatar commented on May 30, 2024

Not working...

from former.

Anahkiasen avatar Anahkiasen commented on May 30, 2024

Ok I misunderstood the problem from the beginning, I'm really sorry. Just did a test from scratch — I thought the label wasn't displayed, while it is actually displayed but doesn't use the value you provide.
I'm looking into that.


UPDATE : Ok I get what is happening. You see Former keeps track of whether a a given field is displayed in a form or alone. For that it registers when a form opens, and when a form closes.
What is happening here, is that by the time the field is displayed, the template was already parsed by PHP and so the form was both opened and closed before the field is displayed. Thus, you don't get the label that was set on the control group (whose label is displayed), you get the label that was originally binded to the field itself when you created it, as fields outside of forms are displayed inline by default (ie without a wrapping control group).

Unfortunately as this is a core part of PHP I can't help much with that :/
The only solution I can suggest you is this :

<div class="modal-header system">
    <h3>@yield('modal-title')</h3>
</div>
<div class="modal-body system">
    @yield('modal-content')
</div>
<div class="modal-footer system">
    @section('modal-footer')
    <button class="btn" data-dismiss="modal" aria-hidden="true">Abbrechen</button>
    <button class="btn btn-danger">Löschen</button>
    @yield_section
</div>
@layout('templates.modal')

@section('modal-title')
    Form Element Textfeld hinzufügen
@endsection

@section('modal-content')
    {{ Former::vertical_open() }}
    {{ Former::token() }}
    {{ Former::text('name')->label('Nur ein Test') }}
@endsection

@section('modal-footer')
    <button class="btn" data-dismiss="modal" aria-hidden="true">Abbrechen</button>
    <button class="btn btn-success">Hinzufügen</button>
    {{ Former::close() }}
@endsection

from former.

 avatar commented on May 30, 2024

Ok this works, it's not cool but it works ;)

from former.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.