ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

JQuery datepicker doesn't work within EE tags

January 30, 2011 3:15am

Subscribe [4]
  • #1 / Jan 30, 2011 3:15am

    Burunduk

    12 posts

    Hello!

    EE version 2.1.3. Build 20101220

    I’ve got a problem. I want give to user an opportunity to choose expiration date of entry is SAEF via “datepicker”. But it doesn’t work.

    {exp:channel:entry_form channel="blog" return="index" preview="site/entry" use_live_url="no"}
    
    <input id="datepicker" class="formcanvas" type="text" name="expiration_date" value="{expiration_date}" maxlength="23" size="25" />
    [removed]
        $(function() {
            $( "#datepicker" ).datepicker();
        });
        [removed]
    {/exp:channel:entry_form}

    If I remove channel tags it will work correctly. So could you tell me how can I solve this problem?

  • #2 / Jan 30, 2011 9:31am

    Neil Evans

    1403 posts

    i would guess it is EE doing something with the Curly brackets in your javascript function. Try moving that script outside the entry_form tags.

    However, i have done what you ask in the above before without any issue, so not sure it is that.
    Do you have a live example?

  • #3 / Jan 30, 2011 12:54pm

    Burunduk

    12 posts

    nevsie, I thought the same way. I mean js curly brackets. But what should I do? As I know I can’t move expiration date field outside SAEF.

    No, there is no online version. Only localhost.

  • #4 / Jan 30, 2011 12:59pm

    Neil Evans

    1403 posts

    1… You can move the JS outside of the exp:channel:entry_form tags. But you still leave the input tag in place. The expiration date field is still within the exp:channel:entry_form so will be fine?

    That aside, look at the html being outputted in the browser and see what is actually being shown for that area of JS. see if it is actually getting messed up, or if something else is happening.
    What JS errors are you getting?

  • #5 / Jan 30, 2011 3:01pm

    Burunduk

    12 posts

    oh, at first sight it was good idea, but in fact it doesn’t work. I move js outside of the tags. So if I remove the line

    {exp:channel:entry_form channel="blog" return="index" preview="site/entry" use_live_url="no"}

    it will work fine. So now the problem is not the location of js (within or outside), but the presence of the line I mentioned.

    Yeah, I’ve looked at source, there is everything is fine as I see…

    May be the exp:channel:entry tag is calling any function with the same name - datepicker and there is some sort of conflict?

  • #6 / Jan 30, 2011 7:01pm

    Neil Evans

    1403 posts

    well you are going to need to check the source that is output in the browser to test. the jquery UI datepicker is used in the backend, so considering your using a SAEF it is possible your calling it twice causing the conflict. you’ll have to check the JS debug - try using firefox browser and firebug.

  • #7 / Jan 31, 2011 4:48am

    Burunduk

    12 posts

    I’ve tested output source and get the same not working page. But I saw the next code

    type="text/javascript" charset="utf-8" src="http://192.168.10.17/?ACT=jquery"

    So I added the parameter into exp:channel:entry_form tag

    include_jquery="no"

    http://ellislab.com/expressionengine/user-guide/modules/channel/entry_form.html#par_include_jquery

    Thank you 😊

  • #8 / Jan 31, 2011 5:14pm

    Ingmar

    29245 posts

    So, you’re good?

  • #9 / Jan 31, 2011 5:53pm

    Burunduk

    12 posts

    yeah, the problem is solved

  • #10 / Feb 01, 2011 11:20am

    Sue Crocker

    26054 posts

    Thanks for the assist, Nevsie.

    Burunduk, Don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases