3 Posts
Habit
9 years ago
2
Topic

Hi

I have a problem with Conditional States at two date fields. The entry form is for an event. When the user enter a starting date, the end date should automatically filled with the start date. 

My settings:

enddate -> conditional states ---> This field [is Filled by] [startdate@value][#form#] // when [startdate] [isChanged]

Now when I choose a startdate the enddate will filed with the same value. But when I press "save" the endate value will not be saved.... Any advice?

Thanks

Get a VIP membership
9 years ago
1
Level 1

Hello habit,

it's probably due to the fact that the calendar create an hidden input with the sufix _hidden in the ID.

So you can probably add a jquery script for setting this hidden field.

You can add this jquery script in the parameter of the field, at the bottom (orange down arrow), in the textarea "script".

Something like :

$("#my_field_start").on("change", function(){
    $("#my_field_end_hidden").val($(this).val());
});


Best regads.

Lionel

3 Posts
Habit
9 years ago
0
Level 2

Hi Lionel

Thanks for your answer. That could work. I inserted your code (with adjustments for my ids) code in the textarea "script" but it doesn't work (front and backend.

I have the template seblod_one and searched for the code at the output and didn't find this... Where should it be inserted? In the javascript part of the field where also following code is? : 

var cal = Calendar.setup({trigger: "enddatum-trigger",inputField: "enddatum",dateFormat: "%a, %d.%m.%Y",


Best regards,

Habit

Get a Book for SEBLOD