firing dojo onchange based on value selected in co

2019-08-17 05:16发布

When calling dojo.wipein and dojo.wipeout from buttons, everything works great. But calling them based on the value in a combobox: I can't do it. Does anyone know how to make calling client side script depend on the value of a combobox?

In other words, if I change the combobox to "Yes", fire dojo.wipein, if I change the combobox to "No", fire dojo.wipeout.

EDIT: Thank you everyone for your help. Here is the code that worked. I am a beginner in javascript, which might show, but it works.

var comboValue = dojo.byId("#{id:comboBox1}").value
if (comboValue == 'Yes'){
dojo.fx.wipeOut({node:'Lewiston',duration:400}).play();
}else if (comboValue == 'No'){
dojo.fx.wipeIn({node:'Lewiston',duration:400}).play();
}else{
alert("the value is neither yes nor no!")
}

3条回答
趁早两清
2楼-- · 2019-08-17 05:56
dojo.connect(myComboBox, 'onChange', function (evt) {
    var value = myComboBox.get("value");
    if(value == "1")
         // do one thing
    else
         // do the other thing
});
查看更多
小情绪 Triste *
3楼-- · 2019-08-17 06:08

try

   onKeyUp: function(evt){
        if (this.value == 'Yes'){
            //dojo.wipein       
        }else if this.value == 'No'){
            //dojo.wpieout
        }else{
            //others
        }
    }
查看更多
仙女界的扛把子
4楼-- · 2019-08-17 06:10

In your Client Side JavaScript, use the following function:

dojo.byId("#{id:FieldID}").value

Where Field ID is the ID property of your XSP object. This will calculate out the full rendered ID of the element and return its value to use in your client script.

查看更多
登录 后发表回答