web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Marketing Form Date Field without Sundays

(0) ShareShare
ReportReport
Posted on by

Hello,

I have a marketing form for a callback service in which the user can choose with a date field when he would like to be called.
Unfortunately, the fields for Sundays are also available, but shouldn't be here in this case.
Can someone please tell me how I can hide or gray out Sundays here?
Many thanks.

Best regards,

Ferdinand Ganter

pastedimage1604925590306v2.png

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi Clofly,

    My Script is already in Marketing page.

    I think I should debug it well.

    Thank you for the help & quick response.  :)

    Regards,

    Vivek

  • cloflyMao Profile Picture
    25,210 on at

    Hi Vivek,

    Script inside source code of marketing form will always be ignored, it is by design.

    Please put your code to marketing page instead.

    Regards,

    Clofly

  • Community Member Profile Picture
    on at

    Yes field ID is correct. I can also confirm it from pre-suggestions I get while entering field values.

    It works for me when my script is like this & my field is outside the form(that is created in Marketing Page):

     <script>

     $( function() {

       $( "#ba834639-e227-eb11-a813-0022480a006f" ).datepicker({

               beforeShowDay: function (date) {

                   var day = date.getDay();

                   return [(day != 0), ''];

               }

           });

    });

     </script>

    but it does not work when my script is like below for a field inside the marketing form:

    <script>

       MsCrmMkt.MsCrmFormLoader.on('afterFormRender', function (event) {

           $("#ba834639-e227-eb11-a813-0022480a006f").datepicker({

               beforeShowDay: function (date) {

                   var day = date.getDay();

                   return [(day != 0), ''];

               }

           });

       })

    </script>

    And my field on a form is : 

     <div class="lp-form-field" data-required-field="false"><label for="ba834639-e227-eb11-a813-0022480a006f" class="lp-ellipsis" title="">Date String</label><input id="ba834639-e227-eb11-a813-0022480a006f" name="ba834639-e227-eb11-a813-0022480a006f" type="text" placeholder="" class="lp-form-fieldInput" title="" style="width: 100%; box-sizing: border-box;"></div>

    Thank you

  • cloflyMao Profile Picture
    25,210 on at

    Hi Vivek,

    Check whether id of the input field you want to capture is right.

    pastedimage1605520871239v1.png

    Regards,

    Clofly

  • Community Member Profile Picture
    on at

    Hi Clofly,

    For me I am unable to inject a datepicker for a field in a form.

    It is only working for fields outside the form. Have you implemented this before?

    Please help

    Thank you

  • Community Member Profile Picture
    on at

    Hi Clofly,

    thank you for your quick and detailed answer. That helped me alot.

    Thank you.

    Regards,

    Ferdinand

  • cloflyMao Profile Picture
    25,210 on at

    Hi Ferdinand,

    Could the solution work for you?

    Regards,

    Clofly

  • Verified answer
    cloflyMao Profile Picture
    25,210 on at

    Hi Ferdinand,

    Unfortunately, the date picker is built-in widget of browser, the only customization we can add to is setting its earliest and latest date to accept.

    (It is "date" type input element.)

    https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date

    Therefore, the only option for us is to inject a custom date picker to the date field.

    However, due to Dynamics will always set date type field to date type input element, we have to create a single line text field to support custom date picker, 

    then triggering a plugin/flow on update of Contact and on change of the text field to sync string date to real date field.

    Here are steps:

    1. Add required libraries to source code of marketing page.(In its head tag.)

    * jquery.min.js

    * jquery-ui.js

    jquery-ui.css

    
        
        landing page
        
        
        
    

    pastedimage1605000101924v1.png

    2. After form render, inject date picker of jQueryUI to the custom single line text field.

    (We can get its id in HTML editor of marketing form, or with browser inspector.) 

    Because date picker of jQueryUI is supported to disable specific dates.

    pastedimage1605000421114v2.png

    3. Now in marketing form, Sunday has been disabled in calendar.

    pastedimage1605000501913v3.png

    Regards,

    Clofly

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Pallavi Phade Profile Picture

Pallavi Phade 101

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 69 Super User 2025 Season 2

#3
TAHER Mehdi Profile Picture

TAHER Mehdi 58

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans