Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » textarea in Scout?
textarea in Scout? [message #1744648] Thu, 29 September 2016 09:45 Go to next message
Andreas Christ is currently offline Andreas ChristFriend
Messages: 31
Registered: April 2016
Member
We would like to have a HTML "textarea" in one of our forms. e.g. some outcome like:

<textarea rows="4" cols="50">
blablabla
</textarea>


How can we create this in Scout?
Re: textarea in Scout? [message #1744670 is a reply to message #1744648] Thu, 29 September 2016 11:41 Go to previous messageGo to next message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 88
Registered: November 2010
Member
Scout only knows one type of text field: AbstractStringField. Depending on the value of the property "getConfiguredMultilineText", the field is either rendered as <input> or as <textarea>. The property "getConfiguredWrapText" controls if the text area automatically wraps the text or scrolls horizontally. You might also want to set "getConfiguredGridH" to a value greater than 1.

See the "Multiline Text" example in the widgets app: https://scout.bsi-software.com/widgets/?dl=widget-stringfield
Re: textarea in Scout? [message #1744780 is a reply to message #1744670] Fri, 30 September 2016 08:06 Go to previous messageGo to next message
Andreas Christ is currently offline Andreas ChristFriend
Messages: 31
Registered: April 2016
Member
Well, getConfiguredGridH depends on the current grid, but not on the intended number of rows. As in my example rows="4" I would expect a method to render the HTML to that property. If the grid is bigger: don't make the textarea bigger than 4 rows. If the grid is smaller, make a scrollbar, or push the grid's size (height) to the size of the textarea. (Yes, in some Browsers you can resize the textarea by hand, but that's a user thing.)

Currently I have to find a grid height, where the AbstractStringField (with getConfiguredMultilineText) has exactly 4 rows of text.
Re: textarea in Scout? [message #1744783 is a reply to message #1744780] Fri, 30 September 2016 08:39 Go to previous message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 88
Registered: November 2010
Member
What is your intention? The cols/rows attribute is only used by the browser to set the initial size - there is no validation or automatic wrap. In Scout, fields are usually layouted by Scout itself, not by the browser's default logic. The size is determined by the field grid, which you can influence by the getConfiguredGridXY methods. This ensures a nice layout where all fields in a column are the same width etc. What would you expect when a form is resized, if a "normal" Scout field and your "special" textarea are mixed together?

If you really need to have the rows/cols attributes , you can try the following (not sure if it really works, though):

  1. Add your custom JavaScript file to add the rows/cols attributes (Scout does not set those attributes). The easiest way to do this is probably adding a @ModelVariant("MySpecial") annotation to your model class. You can then add a MySpecialStringField.js, which is used instead of the default StringField.js. In that file, you can extend the default string field and add your logic.
  2. Set getConfiguredGridUseUiHeight() = true and getConfiguredGridUseUiWidth() = true on your model field.
Previous Topic:Empty row in smartfield
Next Topic:Default login form after deploy to Tomcat 9
Goto Forum:
  


Current Time: Sat Jul 22 23:08:11 GMT 2017

Powered by FUDForum. Page generated in 0.01547 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software