Can't set the all day event field to true on form load

rss

Posted by mcgaafar - Feb 23 ’16 at 04:45

Hi,

I'm trying to set the all day event checkbox on a new calender form to checked (True) on form load via javascript as follows:

fd.field('fAllDayEvent').value('1');

however it's not working.

Appreciate your help, and thanks in advance.

  • rostislav
    rostislav
    Moderator
    Member for: 5 years 4 months 26 days
    #1 by rostislav Feb 24 ’16 at 05:59

    Hi,

    Try this:

     fd.field('fAllDayEvent').control()._el().find('input').attr('checked', true);
  • mcgaafar
    Member
    Member for: 4 years 8 months 12 days
    #2 by mcgaafar Feb 24 ’16 at 04:24

    [#1]: Thanks for the reply, yes this made the all day event checkbox checked now, however the time controls for start time and end time of the event did not hide like the default behavior, so how can i get this to work?

    Thanks again.

     

  • rostislav
    rostislav
    Moderator
    Member for: 5 years 4 months 26 days
    #3 by rostislav Feb 25 ’16 at 06:00

    [#2]:

    Try this:

     fd.field('fAllDayEvent').control()._el().find('input').click();
  • mcgaafar
    Member
    Member for: 4 years 8 months 12 days
    #4 by mcgaafar Feb 26 ’16 at 11:30

    [#3]: Thanks a lot for your reply, it really helped, just to avoid an infinite loop of checking and unchecking the field, i had to place your code in IF condition, here's the code that worked for me:

    var allday = fd.field('fAllDayEvent').control()._el().find('input').is( ":checked" );
    if (allday == false){
    fd.field('fAllDayEvent').control()._el().find('input').click();
    }

Displaying 1 to 4 of 4 messages