+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Sitefinity script unchecking checkbox on pageload

Sitefinity script unchecking checkbox on pageload

5 posts, 0 answered
  1. Dimas
    Dimas avatar
    3 posts
    Registered:
    05 Jan 2015
    06 Apr 2015
    Link to this post

    So I have a script to check the checkbox on the contact form on page load.  I take a look why it wouldn't work and I see why.  When it gets to one of the script that Sitefinity automatically loads it unchecks the checkbox.

    ScriptResource.axd?d=5LbqRcQsGq6my8EsU5qQI4lgoD24FSoX8CWdEgSRSJ9BLqcMnJv-uXBViv09BiftSJLenfqhzmEFw0exVyrfFInuARw4tHQ8oxInxbwa77scEvY5mPJPGi0-fsiQtJi8hAYNpF5j4vEn9F3v4cK8SDBFNWesv8-x5Uf4EC0GrU96ivUAUU1kBhatFNXTCUDv0&t=ffffffff893a8600

     is the script and I don't know what the hell that is. What should I do?

  2. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    23 Sep 2016
    09 Apr 2015
    Link to this post
    Hello Dimas,

    I have just replied in the ticket you have opened related to this.

    I am pasting the reply from the ticket in this forum thread as well for your convenience:

    As far as I can understand from the video demonstration you have dropped a Checkboxes form field control in a form and you would like all the checkboxes to be unchecked by default. If so, please note that you can open the form for edit from Content -> Forms and then you can mark the Checkboxes form field as not required and then uncheck the option selected by default. Please publish the form.

    After performing this, all the checkboxes will be unchecked by default and you will not need to execute your custom javascript for unchecking it.

    I have recorded a video demonstrating the steps on my side and the results. Please find the video attached to this ticket.

     
    Regards,
    Sabrie Nedzhip
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Tenet Health System
    Tenet Health System avatar
    4 posts
    Registered:
    12 Jun 2014
    30 Dec 2015
    Link to this post

    Hi, In our case, we want to check box checked by default on page load. We have applied JavaScript to check check-box, but it automatically unchecked after page load. We have verified it by placing alert messages in our script that Check-box is being checked, but Sitefinity is unchecking it on page load.

    Thanks

  4. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    23 Sep 2016
    31 Dec 2015
    Link to this post
    Hello,

    Try adding a small timeout and execute the check code after the built-in script has unchecked it like so:

    $(document).ready(function() {
        setTimeout(function() {
            // check the checkbox
        }, 350)
    })

    Regards,
    Velizar Bishurov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  5. Tenet Health System
    Tenet Health System avatar
    4 posts
    Registered:
    12 Jun 2014
    01 Jan in reply to Velizar Bishurov
    Link to this post
    Thanks for quick response and great solution - Velizar :)
5 posts, 0 answered