Go Back   SmartClient Forums > Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 7th Dec 2008, 23:57
larryLai larryLai is offline
Registered Developer
 
Join Date: Dec 2008
Posts: 2
Default select box onChange event problem

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 />
But in the smartClient, I don't know how to get the first option item. the following is my code in smartCient framework:
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;
                           }
                      }
                 ]
})
Any help appreciate !

Last edited by larryLai; 8th Dec 2008 at 00:01..
Reply With Quote
  #2  
Old 8th Dec 2008, 08:03
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 30,600
Default

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..
Reply With Quote
  #3  
Old 8th Dec 2008, 18:30
larryLai larryLai is offline
Registered Developer
 
Join Date: Dec 2008
Posts: 2
Default

Quote:
Originally Posted by Isomorphic
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..


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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


© 2010,2011 Isomorphic Software. All Rights Reserved