You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by tubin gen <fa...@gmail.com> on 2009/06/24 19:24:01 UTC
validation for select
I have a dropdown choice with values from enum . In form validation if the
selected value from list is monetarty , then amount field also needs value ,
now my problem is how would I get the selected value in the validator
object
<code>
add(new
DropDownChoice<FindingTypeEnum>("findingType",Arrays.asList(FindingTypeEnum.values())));
//validator
if(FindingTypeEnum.Monetry.equals(getFormComponent("findingType").getValue())){
if(StringUtils.isBlank(getFormComponent("findingAmt").getValue())){
addErrorMessage("Finding Amount is required
for finding type monetary");
}
}
</code>
here in the code getFormComponent("findingType").getValue() return index
of selected value but not the selected object , please tell me If I can
retrieve the selected object from dropdownchoice ?
Re: validation for select
Posted by Igor Vaynberg <ig...@gmail.com>.
formcomponent.getconvertedinput()
-igor
On Thu, Jun 25, 2009 at 7:43 AM, fachhoch<fa...@gmail.com> wrote:
>
>
> here is my question again .I have a drop down choice with list of Item
> objects , If I submit the form the form model object gets updated and I get
> the selected item from the form model object. but I have a form validator
> that gets called before form model object is updated in validator If I want
> to retrieve the selected item , please tell me how can I do this ?
>
>
>
>
>
> fachhoch wrote:
>>
>> I have a dropdown choice with values from enum . In form validation if
>> the
>> selected value from list is monetarty , then amount field also needs value
>> ,
>> now my problem is how would I get the selected value in the
>> validator
>> object
>>
>> <code>
>>
>> add(new
>> DropDownChoice<FindingTypeEnum>("findingType",Arrays.asList(FindingTypeEnum.values())));
>> //validator
>>
>> if(FindingTypeEnum.Monetry.equals(getFormComponent("findingType").getValue())){
>>
>> if(StringUtils.isBlank(getFormComponent("findingAmt").getValue())){
>> addErrorMessage("Finding Amount is required
>> for finding type monetary");
>> }
>> }
>>
>> </code>
>>
>> here in the code getFormComponent("findingType").getValue() return
>> index
>> of selected value but not the selected object , please tell me If I can
>> retrieve the selected object from dropdownchoice ?
>>
>>
>
> --
> View this message in context: http://www.nabble.com/validation-for-select-tp24189224p24204604.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: validation for select
Posted by fachhoch <fa...@gmail.com>.
here is my question again .I have a drop down choice with list of Item
objects , If I submit the form the form model object gets updated and I get
the selected item from the form model object. but I have a form validator
that gets called before form model object is updated in validator If I want
to retrieve the selected item , please tell me how can I do this ?
fachhoch wrote:
>
> I have a dropdown choice with values from enum . In form validation if
> the
> selected value from list is monetarty , then amount field also needs value
> ,
> now my problem is how would I get the selected value in the
> validator
> object
>
> <code>
>
> add(new
> DropDownChoice<FindingTypeEnum>("findingType",Arrays.asList(FindingTypeEnum.values())));
> //validator
>
> if(FindingTypeEnum.Monetry.equals(getFormComponent("findingType").getValue())){
>
> if(StringUtils.isBlank(getFormComponent("findingAmt").getValue())){
> addErrorMessage("Finding Amount is required
> for finding type monetary");
> }
> }
>
> </code>
>
> here in the code getFormComponent("findingType").getValue() return
> index
> of selected value but not the selected object , please tell me If I can
> retrieve the selected object from dropdownchoice ?
>
>
--
View this message in context: http://www.nabble.com/validation-for-select-tp24189224p24204604.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org