Sitefinity script unchecking checkbox on pageload

Posted by Community Admin on 04-Aug-2018 15:22

Sitefinity script unchecking checkbox on pageload

All Replies

Posted by Community Admin on 06-Apr-2015 00:00

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?

Posted by Community Admin on 09-Apr-2015 00:00

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
 

Posted by Community Admin on 30-Dec-2015 00:00

[quote]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

[/quote]

Posted by Community Admin on 31-Dec-2015 00:00

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
 

Posted by Community Admin on 01-Jan-2016 00:00

Thanks for quick response and great solution - Velizar :)

This thread is closed