How to add line feed in <s:textarea> - html

Hi I am using struts 2 UI. I would like to limit the number of characters in row to 16 and also I have to restrict the maxlength to 32. I tried row and column attirbute. But its not working.Also I have to restrict the resizing of textarea. Any possible solutions?

Perhaps you had a typo? The attributes are "rows" and "cols", not "row" and "column".
The following should work:
<s:textarea key="yourDataField" cols="32" rows="16" resizable="false"/>

Here is a nice explanation how to restrict the resizing of textareas
<s:textarea cssStyle="resize: none;"></s:textarea>
should do the job.

Related

How to limit keyboard input with phone number in a gridcolumn tag?

I have a code line that input a phone number in the box.
<GridColumn field="phoneNumber" title="Phone Number" editor="text"/>
With the code below I can input all text from keyboard. But I want to limit keyboard input with number and text "-" only for this column, for example 123-456-7890
I cannot use numberic for editor because it not allow to imput "-" keyboard.
I am using GridColumnProps from GridColumn component of Kendo React.
Anyone can help me get a solution?
Thanks.
You can make use of react-number-format npm package. Here's the link: https://www.npmjs.com/package/react-number-format
This will help you in adding some custom logic as per your requirement.
You can use input type="tel" and/or the pattern attribute for your input field.

pe: inputNumber max length can not larger than 13

I'm using Pe: InputNumber tag in my project, the code is listed like below:
<pe:inputNumber id="transferAccountInputBoxId" styleClass="input-amount-box" thousandSeparator="" maxlength="20" value="#{transferAccountsFlow.accountsInput}" rendered="#{inputPageRenderController.accountsInputBoxRenderer}">
</pe:inputNumber>
But it seems that the value I set for maxlength, it doesn't work at all.
It only can type 13 digits in this input box, but actually i want to type 20 digits.
Is this a bug for this Primefaces Extension tag or not?
It's currently not implemented. Please create a feature request.
NOTE: pe:inputNumber was moved to PrimeFaces.

Update textarea rows via Angularjs

I want to adjust the number of rows in a textArea on focus on remove them on blur. In addition upon focus I want to show a hidden div layer. My current solution is
<textarea class="form-control" rows="1" placeholder="Please enter text..."
onfocus="this.rows=3" ng-focus="isVisible = !isVisible" onblur="this.rows=1"
ng-blur="isVisible = !isVisible"></textarea>
As you can see from above I have to use two attributes, i.e. HTML onfocus to increase the rows and ng-focus to update isVisible (to show and hide the div). It works, but I was wondering if it's possible to increase and decrease the number of rows using ng-focus and ng-blur only.
Div layer I am showing and hiding
<div class="row" ng-show="isVisible" />
Thanks in advance
Basically you could use ng-attr-rows to set rows attribute value dynamically. You could have something like below.
Basically on each digest cycle ng-attr-* directive evaluate its expression, in your case * is rows, and add that evaluated value to rows attribute.
Markup
<textarea ng-model="test"
ng-attr-rows="{{row || '1'}}"
ng-focus="row=3"
ng-blur="row=1">
</textarea>
Demo Plunkr

Only allow certain user input in html form

I am trying to allow only certain data to be inserted into an html form field...
i currently have
pattern="[A-za-z]{2}[0-9]{6}"
which works great for a reference number starting with RQ and then 6 numbers.
how can i add another pattern to allow 3 letters with 8 numbers after that?
for example INM12345678
so that users can only use RQ123456 or INM12345678
try this:
/(RQ\d{6}|INM\d{8})/
here is the demo see here
If you want to limit valid data as said in comment:
^RQ[0-9]{6}|INM[0-9]{8}$

Line chart with fixed y-axis?

I'm trying to have a line chart with a fixed y-axis. that is, I have values that are mostly between 30 and 70, but I'd like to have the chart y-axis as a constant between 0 and 100 so it wouldn't resize as new values are coming in (if they happen to be larger than previous values).
How'd I go about doing this?
Set minimum and maximum properties of LinearAxis. Something like this:
<mx:verticalAxis>
<mx:LinearAxis title="title" displayName="displayName" maximum="100" minimum="0"/>
</mx:verticalAxis>
And don't you want to give a try to existing classes? :)
Yahoo's Astra pack
http://developer.yahoo.com/flash/astra-flash/charts/using.html
Or you may post some sample code so we can see what should be modified.