PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Datepicker field moved, customization fails

  1. isuk
    Member

    Hi,

    I've added a bit of javascript code to the footer.php of my page:

    http://highend.pastebin.com/3vLvusmJ

    The date field is on the first of a multipageform (three steps in total).

    The javascript code works, as long as this field stays on the first page.

    When I move the field to the second or third page, the javascript fails to configure the datepicker for that field.

    The question is: Why does it happen? I'm targeting "#input_1_15" in the script and that ID doesn't change when the field is moved to a different page.

    Regards,
    isuk

    Posted 13 years ago on Tuesday April 26, 2011 | Permalink
  2. With the multi-page forms, the form "pages" don't really reload the document so your script isn't applied in the subsequent pages.. only on the main page load. You need to use the Gform page loaded event to fire your script for the other pages.

    http://www.gravityhelp.com/documentation/page/Gform_page_loaded

    Posted 13 years ago on Tuesday April 26, 2011 | Permalink
  3. isuk
    Member

    Mh,

    I added:
    jQuery(document).bind('gform_page_loaded', function(){
    right after:
    jQuery(document).ready(function($) {

    and ended the script with another:
    });

    Full script here: http://highend.pastebin.com/XwWSnJ6r

    I get no script errors when I open e.g. the second page of the form but the datepicker is still not customized.

    My javascript knowledge is... ähm, very limited, at least...

    Did I make something wrong?

    Posted 13 years ago on Tuesday April 26, 2011 | Permalink
  4. Give this a try:

    http://pastie.org/1836495

    Posted 13 years ago on Tuesday April 26, 2011 | Permalink
  5. isuk
    Member

    Hi David,

    looks very nice but... the datepicker field on page two still refuses to recognize the javascript code (it's still showing sunday as the first date, not translated weeknames, etc.).

    Weired thing ;(

    If you need access to the site to try it yourself, let me know.

    Regards,
    isuk

    Posted 13 years ago on Tuesday April 26, 2011 | Permalink
  6. Sure Isuk, if you'd like you can send your WP & FTP login info over to me at david@rocketgenius.com.

    Posted 13 years ago on Tuesday April 26, 2011 | Permalink
  7. isuk
    Member

    Problem is solved, David was able to find the issue (only certain properties can be reinitialized after the datepicker has initially created and therefore the datepicker must be destroyed at the beginning of the script)!

    Regards,
    isuk

    Posted 13 years ago on Wednesday April 27, 2011 | Permalink

This topic has been resolved and has been closed to new replies.