The isSet() method will only return true after the form is submitted to the action.
I would set the defaultValue for your PreferredCommunicationCode to "MAIL" in intake.xml. This will cause the value to be "MAIL" when a value is not populated from your business object. > -----Original Message----- > From: Mark Lybarger [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 16, 2003 3:45 PM > To: Turbine Users List (E-mail) > Subject: Intake isSet returns wrong value > > > I seem to be having troubles with the isSet method from the > velocity field. According to the code below, if the item is > not set, the default MAIL option should be selected, > otherwise, the database item is the selected item in the > list. The strange thing is that the HTML has two items > selected in the list. To me this indicates that isSet() is > returning false for this item even though it clearly has a value. > > Has any one noticed this behaviour? Hopefully It's just a > logic issue on my part... > > > VTL: > <select name="$eventGroup.PreferredCommunicationCode.key" size="1"> > #foreach ( $method in $methods ) > #if ( (!$eventGroup.PreferredCommunicationCode.isSet() ) && ( > $method.getPreferredCommunicationCode().toString() == "MAIL") ) > <option selected > value="$method.getPreferredCommunicationCode()">$method.getDes > cription()</op > tion> > #else > #if ( $method.getPreferredCommunicationCode().toString() == > $eventGroup.PreferredCommunicationCode.toString()) > <option selected > value="$method.getPreferredCommunicationCode()">$method.getDes > cription()</op > tion> > #else > <option > value="$method.getPreferredCommunicationCode()">$method.getDes > cription()</op > tion> > #end > #end > #end > </select> > > HTML: > <select name="EventGroupKey_0EventPreferredCommunicationKey" > size="1"> > <option value="EMAL">E-mail</option> > <option value="FAX">Fax</option> > <option value="INTR">Internet</option> > <option selected value="MAIL">Mail</option> > <option selected value="PHON">Phone</option> > <option value="PRSN">In Person</option> > </select> > > > Mark Lybarger > [EMAIL PROTECTED] > CBC Companies > 614.442.3741 > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.435 / Virus Database: 244 - Release Date: 12/30/2002 > > > -- > To unsubscribe, e-mail: > <mailto:turbine-user-> [EMAIL PROTECTED]> > For > additional commands, > e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
