Laravel4: How to pass Datepicker into a form?

筅森魡賤 提交于 2019-12-11 07:59:19

问题


For proper validation i have to rewrite into Laravel4 all the form fields i have, the main reason is that i need to add Input::old to all the fields.

So far it went good with text, textarea and checkbox. But i don't know how to deal with the calendar data. It is Datepicker, a pretty nice JQuery plugin: https://github.com/eternicode/bootstrap-datepicker There are two fields, one for the arrival, the other for the outgoing.

This is the html properly working:

            <div class="input-append date ">
              <p>
                <label><span><i class="icon-calendar"></i></span> Arrival Date</label>
                <input type="text" name="arrival" class="datepicker" data-date-format="dd/mm/yyyy" id="checkin" placeholder="click here"/> 
              </p>
            </div>

            <div class="input-append date"> 
              <p>
                <label><span><i class="icon-calendar"></i></span> Outgoing Date</label>
                <input type="text" name="outgoing" class="datepicker" data-date-format="dd/mm/yyyy" id="checkout" placeholder="click here"/>
              </p>                
            </div> 

How can i write this in Laravel4? If for some reason is not possible is not a big deal, but is very important that i can add the Input::old('arrival') and Input::old('outgoing'). Someone knows how can i do it?

Thank you very much!


回答1:


If you have the input as:

value="{{ Input::old('inputName') }}"

it should work as we've discovered!



来源:https://stackoverflow.com/questions/19904059/laravel4-how-to-pass-datepicker-into-a-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!