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.

All select menus in Date drop down field has same ID

  1. gressli
    Member

    Hi,
    I decided to try adding Chosen to the drop down date field. But GF adds the same ID to each select menu when using it. The only select menu that gets the Chosen style properly is the first instance (taking values from the last instance).

    So the day, month and year select menus all have the same ids. The normal functionality works, but the HTML isn't valid. And Chosen doesn't work either.

    I managed to make it work using some hacky preg_replace;

    //Day
    $content = preg_replace("/(<div class='gfield_date_dropdown_day[^>]+\>)(<select name='input_\\d{1,2}\[\]' )(id='input_\\d{1,2}_\\d{1,2}_\\d{1,2})/s", "\$1$2$3_1", $content);
    //Month
    $content = preg_replace("/(<div class='gfield_date_dropdown_month[^>]+\>)(<select name='input_\\d{1,2}\[\]' )(id='input_\\d{1,2}_\\d{1,2}_\\d{1,2})/s", "\$1$2$3_2", $content);
    //Year
    $content = preg_replace("/(<div class='gfield_date_dropdown_year^>]+\>)(<select name='input_\\d{1,2}\[\]' )(id='input_\\d{1,2}_\\d{1,2}_\\d{1,2})/s", "\$1$2$3_3", $content);
    Posted 11 years ago on Thursday December 13, 2012 | Permalink
  2. Does this hack work for you now? We can look at improving this in the future.

    Posted 11 years ago on Thursday December 13, 2012 | Permalink
  3. Hi, I am wondering if you would be able to help me: I have a day/month/year component on a website I want to call fro fake. The problem is: The entire component consists of three separate dropdowns and has only one id numer. Is it possible to somehow call those 3 separate dropdowns or do I need to talk to the website developer about assigning unique ids to all of the dropdowns?

    Posted 11 years ago on Friday March 22, 2013 | Permalink
  4. nsund, I'm not clear on what it is you're trying to do. Can you provide a link to the page on your site where the Gravity Form is embedded so we can take a look at see what you mean? Thank you.

    Posted 11 years ago on Sunday March 24, 2013 | Permalink
  5. Hi Chris

    This is our link: http://www.c-r-l.com/get-a-quote/

    The calendar for Construction Start Date* and Estimated Construction End Date* both have 3 pieces of data, dd/mm/yyyy, the container is actually sent through as one, but we would need a way to make it into 3 individual pieces of data, ie separate dd and mm and yyyy.

    Is this possible and if so please inform on how to do this

    Thank you and kind regards
    Nic

    Posted 11 years ago on Monday March 25, 2013 | Permalink
  6. Rather than use the built in date drop down, I would use 3 separate drop downs; one for day, one for month, one for year. That way, the pieces of information will all be stored in separate fields.

    Posted 11 years ago on Monday March 25, 2013 | Permalink