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

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
mcgaafar
Posts: 44
Joined: Sun Jan 17, 2016

23 Feb 2016

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.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

24 Feb 2016

Hi,

Try this:

Code: Select all

 fd.field('fAllDayEvent').control()._el().find('input').attr('checked', true);

mcgaafar
Posts: 44
Joined: Sun Jan 17, 2016

24 Feb 2016

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.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

25 Feb 2016

Try this:

Code: Select all

 fd.field('fAllDayEvent').control()._el().find('input').click();

mcgaafar
Posts: 44
Joined: Sun Jan 17, 2016

26 Feb 2016

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();
}

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests