简体   繁体   中英

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.

I have used the dojo slider often and have never run into this. document1 is the correct name of the data source. 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 .

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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