|
#1
|
|||
|
|||
|
Hi all:
I am a new newbie of smartclient. I have a problem about the onChange event handling select component, as I know, 'change' property is invalidate in smartClient, instead of the 'onChange' property in js for select component. but when i reselect a same option, the change event can not trigger, in ordinary js code. I can customer onChange function as follow: Code:
<select name=sel onchange="reselectOption(this.options[this.options.selectedIndex].value)">
<option value="">
<option value="1">Item 1
<option value="2">Item 2
<option value="3">Item 3
</select>
<script>
function reselectOption(s)
{
txt.value +=s;
//after reselect, let the first option item is selected, then it can change.
document.all.sel.options[0].selected=true;
}
</script>
<textarea id=txt />
Code:
isc.DynamicForm.create({
ID:"CaseMainForm",
width:"100%",
numCols:2,
colWidths:["15%", "85%"],
autoFocus:false,
fields:[
{
name:"compare1",
title:"Compare1",
type:"select",
valueMap :["Batch","Webservice","xDesign","xRevise","xResponse","Other(Exist)","Other"],
defaultValue:"",
wrapTitle:false,
showIf:"FormServerConfig.getValue('serverType') == 'EE'",
redrawOnChange:true,
required:true,
width:330,
change:function(viewer,item,value){
// I set the first option item here, but it can't work :(
compare1.valueMap[0].selected=true;
}
}
]
})
Last edited by larryLai; 8th Dec 2008 at 00:01.. |
|
#2
|
|||
|
|||
|
Hi Larry,
You want something like CaseMainForm.setValue("compare1", newValue), but, the code as it is doesn't make much sense, it would just set the control to the first value every time the user tried to change it.. |
|
#3
|
|||
|
|||
|
Quote:
Hi Isomorphic: First, thanks for your reply! yes,I think it doesn't make much sense, my requirement is that, i need the change function of select box respond to the mouse event very time,what ever it selects a different item or a same item comparing with foregoing selecting action,in smartclient. just like click event, formely, I want use click event instead,but there is some potential problem, Select box doesn't have "click" event in w3c specification. Now my solution is that, use a text box and a select box together, final value is set to the text box, and select box just to implement special-effects I needed(I need a new window to pop up when change the selecting), I am not clearly whether there is other preferable solution in smartclient, and I have another problem, how to overlap the two component, enable them look like one box! Any help appreciate ! thanks |