简体   繁体   English

xpages水平滑块抛出javascript错误

[英]xpages horizontal slider throwing a javascript error

When I move the slider the first time this pops up 当我第一次移动滑块时,它会弹出

An error occurred while updating some of the page. 更新某些页面时发生错误。 document1 is undefined. 未定义document1。

I have used the dojo slider often and have never run into this. 我经常使用dojo滑块,但从未遇到过。 document1 is the correct name of the data source. document1是数据源的正确名称。 The slider writes to a field and the value is actually saved correctly. 滑块将写入字段,并且该值实际上已正确保存。 Everything is working but why am I getting this error? 一切正常,但为什么会出现此错误?

<xe:djHorizontalSlider id="djHorizontalSlider7"
                value="#{viewScope.sliderNumber7}"
                style="margin: 5px;width:480px; height:20px;" minimum="0"
                maximum="100" discreteValues="101" showButtons="false">

                <xe:this.defaultValue><![CDATA[#{javascript:document1.getItemValueInteger("Burns_Pct")}]]></xe:this.defaultValue>

                <xp:this.converter>
                    <xp:convertNumber integerOnly="true">
                    </xp:convertNumber>
                </xp:this.converter>
                <xe:djSliderRule id="djSliderRule7"
                    style="height:5px;" count="3" container="bottomDecoration">
                </xe:djSliderRule>
                <xe:djSliderRuleLabels id="djSliderRuleLabels7"
                    container="bottomDecoration"
                    style="height:10px;font-size:100%;color:black;">
                    <li>
                        0 Percent
                    </li>
                    <li></li>
                    <li>
                        100 Percent
                    </li>
                </xe:djSliderRuleLabels>
                <xp:eventHandler event="onChange" submit="true"
                    refreshMode="partial" refreshId="Burns_Pct">
                    <xe:this.action><![CDATA[#{javascript:
viewScope.inputNumber7 = viewScope.sliderNumber7
        }]]></xe:this.action>


                </xp:eventHandler>
            </xe:djHorizontalSlider>

I found my own answer after trying for a couple of days. 尝试了几天后,我找到了自己的答案。

I had script in the xpage onClientLoad section when it should have been in the beforePageLoad . 当xpage onClientLoad部分中的脚本应该位于onClientLoad时,我就拥有该beforePageLoad

The purpose of this was to make sure the slider goes to the correct place if the user navigates between pages of survey. 这样做的目的是,如果用户在调查页面之间导航,请确保将滑块移到正确的位置。 So, I am grabbing the value of the stored text box on document1 and assigning the slider control the value when the page loads. 因此,我要抓取document1上存储的文本框的值,并在页面加载时为滑块控件分配值。

我们在页面上看不到您的文档定义,但我认为它根本不是您的数据源的正确名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM