on 11-29-2010 7:50 AM
Hi All,
I have a list box with multiple select on the form with list (Say A,B,C,D,E,F,G ..)
When I select A,C,E ans say this.RawValue I get A,C,E separated by carrage returns.
When i submit the form in my Fm I get A#C#E its all fine.
Now when the form is openend for the 2nd time to update values I get the value as A,C,E separated by carrage return thats fine too.
Now i need to set these 3 values as selected by default so i had some java script in form ready.
Where i iterate tru these list match the entries in the dropdown its fine untill here.
this.setItemState(index,true)
is the code to set them as selected but when i do only the 1st found is set to selected not the remaining ones.
Am i doing something wrong here, please let me know with your suggestions.
below is my script.
var ddValue = this.rawValue;
ddValue = ddValue.replace("#","\n");
var ddArray = ddValue.split("\n");
var ddLen = ddArray.length;
var textValue = "";
GM_INTAKE_STRUCTURE.sf80.sfItemBuilder.sfHeaderConditions.dlExpenseType.clearItems;
GM_INTAKE_STRUCTURE.sf80.sfRequestSummary.dlItem.clearItems;
for(var i = 0;i<ddLen;i++){
for(var j = 0;j<this.length;j++){
if(this.getSaveItem(j) == ddArray<i>){
this.setItemState(j,true);
GM_INTAKE_STRUCTURE.sf80.sfItemBuilder.sfHeaderConditions.dlExpenseType.addItem(this.items.nodes.item(j).value,this.getSaveItem(j));
}
}
}
Thanks & Regards,
Sai
Hello Sai,
don´t have time to recreate everything etc. but I remember this thread: is it possible this could help you?
Otto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sai,
The replace function is only replacing the first occur of #, not all of them. But you don't even need to replace the # before you do the split, just change your first lines to split directly with the # character. Your code should look as follow:
var ddValue = this.rawValue;
var ddArray = ddValue.split("#");
var ddLen = ddArray.length;
var textValue = "";
GM_INTAKE_STRUCTURE.sf80.sfItemBuilder.sfHeaderConditions.dlExpenseType.clearItems;
GM_INTAKE_STRUCTURE.sf80.sfRequestSummary.dlItem.clearItems;
for(var i = 0;i<ddLen;i++){
for(var j = 0;j<this.length;j++){
if(this.getSaveItem(j) == ddArray<i>){
this.setItemState(j,true);
GM_INTAKE_STRUCTURE.sf80.sfItemBuilder.sfHeaderConditions.dlExpenseType.addItem(this.items.nodes.item(j).value,this.getSaveItem(j));
}
}
}
Best regards, Aldo.
Any comments and feedback are welcome.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aldo,
Thanks for the reply..
Splitting is not the problem for my code, i coukld get each individual item, and compare it.
But when the item is found in the dd list i need to set it to selected for which the code is
This.setItemState(<index> ,true); when i do this only the 1st found index is set.
I also tried it with hardcoded index irrespective of my loop and script as below.
this.setItemState(1,true);
this.setItemState(3,true);
this.setItemState(5,true);
even then only the 2ns record which of index 1 is set to selected.
Any ideas around this ...?
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.