TextArea and Collection as Model
Hi, I use a |TextArea| component in a form so that users can enter a set of IP addresses. The target model is of type |CollectionString|. I have written a validator to validate the raw user input an a converter to convert the string input into a collection of strings (|CollectionString|). Now I cannot set the model for the used |TextArea| instance it has a different object type then |String|. Any idea how to handle this? |public class MyFormFormModel { private final TextAreaString cripField; } // The validator is validating the raw string public class CripBlockValidator implements IValidatorString {/*...*/} // The converter coverts the string input into a subtype of ListString public class CripBlockConverter extends AbstractConverterIPList {/*...*/} |
Re: TextArea and Collection as Model
I solved now this problem by subclassing TextArea and over-writing convertInput(). But now Wicket complains if I reference this field as textarea ... in my HTML template. I must declare it as input... but I need a textarea/ Does someone know how to achive this? Bye, Oliver Am 28.05.14 14:27, schrieb Oliver B. Fischer: Hi, I use a |TextArea| component in a form so that users can enter a set of IP addresses. The target model is of type |CollectionString|. I have written a validator to validate the raw user input an a converter to convert the string input into a collection of strings (|CollectionString|). Now I cannot set the model for the used |TextArea| instance it has a different object type then |String|. Any idea how to handle this? |public class MyFormFormModel { private final TextAreaString cripField; } // The validator is validating the raw string public class CripBlockValidator implements IValidatorString {/*...*/} // The converter coverts the string input into a subtype of ListString public class CripBlockConverter extends AbstractConverterIPList {/*...*/} | - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: TextArea and Collection as Model
Hi, Wicket calls validators after conversion, thus if you have TextAreaCollectionString, your validator has to be IValidatorCollectionString. Let your CripBlockConverter do the format checking, I don't see the need for your converter. But now Wicket complains 'Complains' means what? Sven On 05/28/2014 03:20 PM, Oliver B. Fischer wrote: I solved now this problem by subclassing TextArea and over-writing convertInput(). But now Wicket complains if I reference this field as textarea ... in my HTML template. I must declare it as input... but I need a textarea/ Does someone know how to achive this? Bye, Oliver Am 28.05.14 14:27, schrieb Oliver B. Fischer: Hi, I use a |TextArea| component in a form so that users can enter a set of IP addresses. The target model is of type |CollectionString|. I have written a validator to validate the raw user input an a converter to convert the string input into a collection of strings (|CollectionString|). Now I cannot set the model for the used |TextArea| instance it has a different object type then |String|. Any idea how to handle this? |public class MyFormFormModel { private final TextAreaString cripField; } // The validator is validating the raw string public class CripBlockValidator implements IValidatorString {/*...*/} // The converter coverts the string input into a subtype of ListString public class CripBlockConverter extends AbstractConverterIPList {/*...*/} | - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: TextArea and Collection as Model
Ok, I thought the validation happens before the conversion. So the converter must also validate the raw input. Feels a little bit strange but is ok. Complains meens that I get the following exception message: Component [cripsFld] (path = [14:panel:formular:formGroup4Crips:formGroup4Crips_body:cripsFld]) must be applied to a tag of type [input], not: 'textarea class=form-control id=cripsFld wicket:id=cripsFld style=resize: none placeholder=List of CRIP addresses autocomplete=off' (line 0, column 0) Oliver Am 28.05.14 15:23, schrieb Sven Meier: Hi, Wicket calls validators after conversion, thus if you have TextAreaCollectionString, your validator has to be IValidatorCollectionString. Let your CripBlockConverter do the format checking, I don't see the need for your converter. But now Wicket complains 'Complains' means what? Sven On 05/28/2014 03:20 PM, Oliver B. Fischer wrote: I solved now this problem by subclassing TextArea and over-writing convertInput(). But now Wicket complains if I reference this field as textarea ... in my HTML template. I must declare it as input... but I need a textarea/ Does someone know how to achive this? Bye, Oliver Am 28.05.14 14:27, schrieb Oliver B. Fischer: Hi, I use a |TextArea| component in a form so that users can enter a set of IP addresses. The target model is of type |CollectionString|. I have written a validator to validate the raw user input an a converter to convert the string input into a collection of strings (|CollectionString|). Now I cannot set the model for the used |TextArea| instance it has a different object type then |String|. Any idea how to handle this? |public class MyFormFormModel { private final TextAreaString cripField; } // The validator is validating the raw string public class CripBlockValidator implements IValidatorString {/*...*/} // The converter coverts the string input into a subtype of ListString public class CripBlockConverter extends AbstractConverterIPList {/*...*/} | - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: TextArea and Collection as Model
cripsFld is a TextArea? TextArea#onComponentTag(): public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { checkComponentTag(openTag, textarea); The exception indicated you have some other component here. Sven On 05/28/2014 03:47 PM, Oliver B. Fischer wrote: Ok, I thought the validation happens before the conversion. So the converter must also validate the raw input. Feels a little bit strange but is ok. Complains meens that I get the following exception message: Component [cripsFld] (path = [14:panel:formular:formGroup4Crips:formGroup4Crips_body:cripsFld]) must be applied to a tag of type [input], not: 'textarea class=form-control id=cripsFld wicket:id=cripsFld style=resize: none placeholder=List of CRIP addresses autocomplete=off' (line 0, column 0) Oliver Am 28.05.14 15:23, schrieb Sven Meier: Hi, Wicket calls validators after conversion, thus if you have TextAreaCollectionString, your validator has to be IValidatorCollectionString. Let your CripBlockConverter do the format checking, I don't see the need for your converter. But now Wicket complains 'Complains' means what? Sven On 05/28/2014 03:20 PM, Oliver B. Fischer wrote: I solved now this problem by subclassing TextArea and over-writing convertInput(). But now Wicket complains if I reference this field as textarea ... in my HTML template. I must declare it as input... but I need a textarea/ Does someone know how to achive this? Bye, Oliver Am 28.05.14 14:27, schrieb Oliver B. Fischer: Hi, I use a |TextArea| component in a form so that users can enter a set of IP addresses. The target model is of type |CollectionString|. I have written a validator to validate the raw user input an a converter to convert the string input into a collection of strings (|CollectionString|). Now I cannot set the model for the used |TextArea| instance it has a different object type then |String|. Any idea how to handle this? |public class MyFormFormModel { private final TextAreaString cripField; } // The validator is validating the raw string public class CripBlockValidator implements IValidatorString {/*...*/} // The converter coverts the string input into a subtype of ListString public class CripBlockConverter extends AbstractConverterIPList {/*...*/} | - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: TextArea and Collection as Model
You are right. I used a TextField. Thx! Am 28.05.14 15:49, schrieb Sven Meier: cripsFld is a TextArea? TextArea#onComponentTag(): public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { checkComponentTag(openTag, textarea); The exception indicated you have some other component here. Sven On 05/28/2014 03:47 PM, Oliver B. Fischer wrote: Ok, I thought the validation happens before the conversion. So the converter must also validate the raw input. Feels a little bit strange but is ok. Complains meens that I get the following exception message: Component [cripsFld] (path = [14:panel:formular:formGroup4Crips:formGroup4Crips_body:cripsFld]) must be applied to a tag of type [input], not: 'textarea class=form-control id=cripsFld wicket:id=cripsFld style=resize: none placeholder=List of CRIP addresses autocomplete=off' (line 0, column 0) Oliver Am 28.05.14 15:23, schrieb Sven Meier: - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org