This is the macro i made.
{{Form::macro('date', function()
{
return ' <input type="date" data-clear-btn="true" name="date-2" id="date-2" value="">';
}); }}
This is the jquerymobile data picker element. And has a data clear button: data-clear-btn="true" Now in my view i want to decide if the data-clear button is displaying so i typed:
{{ Form::date("false","date-2","date-2","")}}
This does not seem to work. Does anyone know why?
It won't magically happen unless you do something like this:
Form::macro('date', function($clear, $name, $id, $value) {
return "<input type=\"date\" data-clear-btn=\"$clear\" name=\"$name\" id=\"$id\" value=\"$value\">";
});
how does PHP know that your first parameter is data-clear-btn?
Form::macro('date', function($clearbtn = true, $name = '', $id = '') {
return ' <input type="date" data-clear-btn="'.$clearbtn.'" name="'.$name.'" id="'.$id.' value="">';
});
EDIT what popolla said ;)
@zenry: I'm the unlucky one, my code doesn't get PHP syntax highlighting! :D
EDIT: fixed !!
Well the string could be dissected to detect html properties or is this too far fetched?
BTW my PHP is very bad. :P
Would be a nice capability if laravel could do that though XD I'm going to look in to that!
Thanx for the help guys.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community