troubleshooting Question

struts html:select dropdown

Avatar of Jagadeesh M
Jagadeesh MFlag for United States of America asked on
JavaJavaScriptJSP
9 Comments1 Solution421 ViewsLast Modified:
Hi -

I'm using Struts.

I've a drop down for displaying the status of the property and i need to add a confirm dialog box for this -

Here is a sample code snippet -

<html:select styleClass="formTextField" property="propStatusCd" tabindex="1" onchange="return confirmPropStatusChange();"  >
     <html:option value="">-- Select --</html:option>
      <html:options collection="<%=LookupTypeDropdownUtils.LOOKUPENM_PropertyStatusLookupType%>"
        property="typeIdCode" labelProperty="typeName" />
 </html:select>


And here is my javascript -


<SCRIPT language="JavaScript">
<!--
function confirmPropStatusChange() {
  if (confirm("!")) {
    return true;
  } else {
    return false;
  }
}
//-->
</SCRIPT>

Now when i change the dropdown value, the confirm dialog box is being prompted but irrespective of whether i select "OK" or "CANCEL" the drop down value is getting changed.

But it should be something like - When i select "OK" the new value should be retained but when i select "CANCEL" the old value should be retained.

Please advice.

Thank You-
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros