WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Initialize the end date with the start date (9 posts)

  1. Gwentrac
    Member
    Posted 1 year ago #

    Hello,

    In the "events add page" I would like to initialize the end-date field with the start-date field.
    When the user filled the start-date I want to copy the value also in the end date field.

    Does anyone know how to do that?

    I think that I should make some change in the javascript file?

    Best regards,

    Gwen

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 1 year ago #

    at the moment, you need to make some change in the javascript file.

  3. Gwentrac
    Member
    Posted 1 year ago #

    Hello.

    Could you confirm that I have to change only the file events-manager\includes\js\events-manager.js ?

    Moreover, could you tell me which function should I change? I spend more than 4 hours this week end and I don't find how to do it. : (

    Thanks in advance.

    Best regards.

    Gwen

  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    I wouldn't change that file, you'd want to add a new file using WP methods and ad your JS there so it's not overwritten on your updates

    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

    You could try overriding the events template templates/forms/event/when.php

    http://wp-events-plugin.com/documentation/using-template-files/

  5. Gwentrac
    Member
    Posted 1 year ago #

    Hello,

    Ok I added my custom js file. It's working

    I tried to had the following javascript code but It doesn't work.

    document.getElementById('gtr_start_date').onchange=function(){
    var t1 = document.getElementById('gtr_start_date').value;
    document.getElementById('gtr_end1_date').value = t1;
    };

    With "gtr_start_date" and "gtr_end_date" the id of the date texts field.

    I don't find which javascript event used corresponding to the start_date selection.

    Could you help me, please?

    Best regards,
    Gwen

  6. agelonwl
    Member
    Posted 1 year ago #

    have you tried @Marcus suggestion; using 'templates/forms/event/when.php' template file instead? you can create your own javascript here.

  7. Gwentrac
    Member
    Posted 1 year ago #

    Yes, I overload the file 'templates/forms/event/when.php' to give specific ID et name to the 2 fields.
    Then I added my javascript code in my theme js file.

    My problem now is to find which javascript event used to fill automatically the end_date field.

    Any idea, please?

    Best regards,
    Gwen

  8. agelonwl
    Member
    Posted 1 year ago #

  9. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    you'd use something like jQuery(...).change(...)

    or locate the element using jquery selectors and use the datpicker methods e.g. dateInput.datepicker('option','onSelect',...

    http://api.jqueryui.com/datepicker/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic