开发者

symfony - jquery datetime picker

I am going to have a datetime value in my admin module and I was looking for a jquery/javascript way of populating the widget as a datetime.

I have looked at the sfExtraFormPlugin and 开发者_StackOverflowgo the datepicker working, but it seems that there is no datetime widget.

Is there another alternative?

I am using sf1.4


There's the jQuery UI Datepicker - lots of options and a nice presentation, not to mention it's from a well supported library.

http://jqueryui.com/demos/datepicker/


Another interesting widget :

http://www.malot.fr/bootstrap-datetimepicker/demo.php

You can both select date and time values. I don't know how to plug it with symfony 1.4, but here is the integration with symfony 2.0 :


    {% block datetime_widget %}
    {% spaceless %}
        {% if widget == 'single_text' %}
            {# block('form_widget_simple') #}
            {{ form_errors(form) }}
            <input type="hidden" id="{{ id }}" name="{{ name }}" value="{% if value %}{{ value|date('Y-m-d H:i:s') }}{% endif %}" />
            <div class="input-append date datetime-picker" data-date="{% if value %}{{ value|date('Y-m-d H:i:s') }}{% endif %}" data-link-field="{{ id }}">
                <input size="16" type="text" value="{% if value %}{{ value|date('j F Y - H:i') }}{% endif %}" readonly>
                <span class="add-on"><i class="icon-remove"></i></span>
                <span class="add-on"><i class="icon-th"></i></span>
            </div>
        {% else %}
            <div {{ block('widget_container_attributes') }}>
                {{ form_errors(form.date) }}
                {{ form_errors(form.time) }}
                {{ form_widget(form.date) }}
                {{ form_widget(form.time) }}
            </div>
        {% endif %}
    {% endspaceless %}
    {% endblock datetime_widget %}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜