Thanks, It's in the CVS now!
Henner > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > Sent: Monday, December 05, 2005 7:05 PM > To: [email protected]; [EMAIL PROTECTED] > Subject: Bug fix in db:select tag > > When specifying a [selected] customEntry... (ie: > customEntry = "999,someValue,true") > In INSERT mode, this should be the only option selected. > However, the select tag uses the default value to set the > option to be selected. In INSERT mode, this is by default 0. > The problem is that I have an option who's key is 0. Hence, > I end up with 2 selected options! (and the wrong one takes > precedence!) > > My change is to reset the currentValue to the custom value > when appropriate. (ie: currentValue = 999) See code extract below. > > > > > public int doEndTag() throws javax.servlet.jsp.JspException { > > ... > > > if (embeddedData != null) { > // PG, 2001-12-14 > // Is their a custom entry? Display first... > String ce = null; > > if (((ce = this.getCustomEntry()) != null) && (ce.trim() > > .length() > 0)) { > boolean isSelected = false; > String aKey = org.dbforms.util.StringUtil > .getEmbeddedStringWithoutDots(ce, 0, ','); > String aValue = org.dbforms.util.StringUtil > > .getEmbeddedStringWithoutDots(ce, 1, ','); > > // Check if we are in redisplayFieldsOnError mode > and errors have occured > // If so, only set to selected if currentRow is > equal to custom row. > if ((getParentForm() > .hasRedisplayFieldsOnErrorSet() && > (errors != null) > && (errors.size() > 0)) > || ((we != null) > && > (we.getType().equals(EventType.EVENT_NAVIGATION_RELOAD)))) { > isSelected = (currentValue.equals(aKey)); > } else { > isSelected = "true".equals(org.dbforms.util.StringUtil > > .getEmbeddedStringWithoutDots(ce, 2, > > ',')); > } > > if (isSelected) { > selectedOptions.append("-") > .append(aKey); > > /* Philip Grunikiewicz > * 2005-12-05 > * > * If in INSERT Mode and custom entry is set as default > */ > if (getParentForm().isFooterReached()) > { > currentValue = aKey; > } > } > > tagBuf.append(generateTagString(aKey, aValue, > isSelected)); > } > > ... > > } > > ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ DbForms Mailing List http://www.wap-force.net/dbforms
