Christoph, the html code used when the "Edit" link gets clicked looks like the following. So the iterator has run and has pulled back a bunch of records. Then for any of the items on the list you can click edit which will extract the relevant data fields for the selected record and populate the lower half of the screen.

<td class="oddRow"><a <%=linkmouseover%> href="javascript:editPropertyContent('<s:property value="itemRoom"/>', '<s:property value="itemCategory"/>', '<s:property escape="false" value="itemDescriptionHtml"/>', '<s:property escape="false" value="itemReplacementHtml"/>', '<s:property escape="false" value="itemReplacementUrlHtml"/>', '<s:property value="itemReplacementValue"/>', '<s:property value="itemValidationStatus"/>', '<s:property value="itemFulfillmentStatus"/>');">Edit</a></td>

We use this approach where we have a list at the top half of the screen and a details area for adding and editing at the bottom half of the screen a lot. And it does work OK. Except for this screen which is the 1st time we have experimented using the doubleselect tag.

I thought maybe the problem was some of the auto generated code that gets inserted into the html when the page loads. Perhaps the 2nd field in the double select does get populated but then gets overwritten?

Patrick Kelly

PatrickKelly
PrincipalConsultant
*River**Dynamics*

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

On 18/02/2015 9:18 PM, Christoph Nenning wrote:
Christoph - I think so. It was not throwing any javascript errors in
Firefox javascript console.

It was defined in the doubleselect statement below and i could see it in
the generated html in view page source.

<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')}"/>



In your first screenshot you showed us how the table of itmes looks. Can
you post the HTML for that?
How looks the whole JavaScript when you click the edit Link?


You are using document.getElementById() but you have not just one single
table row but multiple ones.
So it seems the HTML-IDs you use are not unique.


Regards,
Christoph







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

On 18/02/2015 7:20 PM, Christoph Nenning wrote:
      document.getElementById("itemCategory").value = itemCategory;
Are you sure that itemCategory is present in the html table and can be
accessed by JavaScript?





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:

[Bild entfernt]


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:

[Bild entfernt]


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.

[Bild entfernt]


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
Principal Consultant
River Dynamics
E:  patrick.ke...@riverdynamics.com
W: www.riverdynamics.com

This Email was scanned by Sophos Anti Virus

This Email was scanned by Sophos Anti Virus


Reply via email to