I am trying to get a double select tag to work for the 1st time and am having some problems.

The JSP involved comprises a list in the top half of the page where an iterator fetches data from the database which is displayed in the list like so:




The bottom half of the screen comprises a form where you can add and edit an item before pressing save which updates the database and re-displays the page with the new or updated item now appearing in the list.

The add/edit area looks like so when the page originally loads:




Adding an item works OK.

I use the following tags in the add/edit area for the 2 fields that are populated via the double select (I have removed some of the options for brevity in this email):

<s:set name="itemList" value="#{'Antiques': {'Antiques'}, 'Bathroom': {'Cosmetics', 'Hamper', 'Lines', 'Medical items', 'Other', 'Scales', 'Shower curtains', 'Sundries'}, 'Garage': {'Hand tools', 'Other', 'Power tools', 'Tool chests', 'Work bench'}}"/>

<s:doubleselect label="Select room and item" name="claimContent.itemRoom" id="itemRoom" emptyOption="true" requiredLabel="true" list="#itemList.keySet()" doubleName="claimContent.itemCategory" doubleId="itemCategory" doubleEmptyOption="true" doubleList="#itemList[top]" tooltip="%{getText('claimContent.itemRoom.tooltip')}"/>

So that all seems OK.

But if I want to edit an existing item, then immediately after clicking the "Edit" link beside some item in the list, the screen looks like so. As you can see the 2nd field in the double-select has not been set correctly and is is showing as nothing with no options to select from. I have to change the 1st field to some other value to get options to appear in the 2nd field.




The javascript I use to when the "Edit" link is clicked looks like:

function editPropertyContent(itemRoom, itemCategory, itemDescription, itemReplacement, itemReplacementUrl, itemReplacementValue, itemValidationStatus, itemFulfillmentStatus) {

    document.getElementById("itemRoom").value = itemRoom;
    document.getElementById("itemCategory").value = itemCategory;
    document.getElementById("itemDescription").value = itemDescription;
    document.getElementById("itemReplacement").value = itemReplacement;
document.getElementById("itemReplacementUrl").value = itemReplacementUrl; document.getElementById("itemReplacementValue").value = itemReplacementValue; document.getElementById("itemValidationStatus").value = itemValidationStatus; document.getElementById("itemFulfillmentStatus").value = itemFulfillmentStatus;

}

That is all a bit long winded - anyway hoping someone can point me in the right direction.

Regards - Patrick

--
Patrick Kelly

PatrickKelly
PrincipalConsultant
*River**Dynamics*

E: patrick.ke...@riverdynamics.com <mailto:patrick.ke...@riverdynamics.com>
W: www.riverdynamics.com <http://www.riverdynamics.com/>

Reply via email to