最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - JS Conflict Between Custom Widget and Form Calendar Element - Stack Overflow

programmeradmin0浏览0评论

I made a widget to add a custom question to the source code from a form created by a drag and drop form builder (jotform) and it works inside a simple form.

However, when I add a jotform calendar element, the calendar doesnt work and the "Next: button is disabled so the form wont proceed to the next page (where I would like to keep my widget).

All of the code can be viewed in an online code editor with the links below.

Form 1 works- /

Form 2 doesnt work-/

The issue seems related to the inclusion of this script in the calendar form: <script src=".0.9.min.js?v=3.3.58718" type="text/javascript"></script> as compared to the form that works.

The calendar also introduces the following JavaScript logic:

JotForm.calendarMonths = ["January","February","March","April","May","June","July","August","September","October","November","December"];
if (!JotForm.calenderViewMonths) JotForm.calenderViewMonths = {}; JotForm.calenderViewMonths[6] = ["January","February","March","April","May","June","July","August","September","October","November","December"];
if (!JotForm.calenderViewDays) JotForm.calenderViewDays = {}; JotForm.calenderViewDays[6] = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
JotForm.calendarDays = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
JotForm.calendarOther = {"today":"Today"};
var languageOptions = document.querySelectorAll('#langList li');
for(var langIndex = 0; langIndex < languageOptions.length; langIndex++) {
languageOptions[langIndex].on('click', function(e) { setTimeout(function(){ JotForm.setCalendar("6", false, {"days":{"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"sunday":true},"future":true,"past":true,"custom":false,"ranges":false,"start":"","end":"","countSelectedDaysOnly":false}); }, 0); });
}
JotForm.onTranslationsFetch(function() { JotForm.setCalendar("6", false, {"days":{"monday":true,"tuesday":true,"wednesday":true,"thursday":true,"friday":true,"saturday":true,"sunday":true},"future":true,"past":true,"custom":false,"ranges":false,"start":"","end":"","countSelectedDaysOnly":false}); });

I tried modifying widget code unsuccessfully. I think use of an iframe might help but I am stuck on this. How can I resolve this error or work around it? If there is a way to modify my widget's code that would be ideal.

发布评论

评论列表(0)

  1. 暂无评论