1

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!

7
  • to be sure, you just need to be able to pass in the class attribute right? Commented Nov 11, 2013 at 10:32
  • The goal is that if there are some errors in the form, the fields that was already filled up will remain filled up. So what i need is somehow add Input::old('') to that two Datepicker fields. Commented Nov 11, 2013 at 10:35
  • Are you creating the two inputs with blade? If so can you edit and post that code? Commented Nov 11, 2013 at 10:36
  • No no. At the moment the two fields are only in html. Commented Nov 11, 2013 at 10:37
  • 1
    Well, if I understand how Input::old() works (never used it) I would say that maybe adding value="<?php echo Input:old()?>" might work? Commented Nov 11, 2013 at 10:40

1 Answer 1

1

If you have the input as:

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

it should work as we've discovered!

Sign up to request clarification or add additional context in comments.

2 Comments

with blade syntax will be: value="{{ Input::old('inputName') }}"
Good point! I was kind of thinking on the idea that the whole input wasn't with blade so I should use normal PHP! I'll update it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.