Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Sync two Gravity Forms Datepicker fields (Jquery) WordPress

  • SOLVED

Hi,

I'm using Gravity forms to set a 'start' and 'end' date using their built-in JQuery UI Datepicker, what I want is when somebody enters a start date, say for example: 10/01/2014 the second datepicker box goes automatically to 17/01/2014 - the user can then select it and change the date if they require - but it shouldn't effect the first box.

It's just a bit of usability and I'm sure a relatively quick fix for someone that's good with Jquery! Currently when you select the second box it defaults to January which is a bit of a pain.

Here's the page in question (2 examples on this page): http://ibiza2014.net/hotel/bora-bora-apartments/#.Us7I46X7UnV

Please help - been searching all day and tried 'keyup & paste & blur' code snippets but these only work for typed in data- not data selected from the datepicker: Example:

$("#input_A").bind("keyup paste", function() {
$("#input_B").val($(this).val());
});


Ta

Answers (2)

2014-01-09

Kyle answers:

Try with 'change'

$("#input_A").change( function() {

$("#input_B").val($(this).val());

});


http://stackoverflow.com/questions/8618994/jquery-ui-date-picker-updating-another-date-picker-on-selecting-a-date


Kyle comments:

The answer below me is from the same link I pasted, either solution should get the job done for you.


Meakin comments:

Works perfectly - knew it would be simple! Thanks Kyle!

2014-01-09

Sai kumar answers: