Limit TextField to specifc number of lines

Hi,
First of all the limit to character number is not enough for my case. I would like to make sure that the user won't be able to enter more than 3 lines of text. In addition the field can be either filled in directly or using two other fields + button (as you can see below).
I managed to limit the amount of text that user can enter into the field by using the following two lines of codes:
Initialize:
this.maxH = "18mm"; //3 lines
Full:
xfa.event.change = "";
and checking those two checkboxes in the "Object/Field":
[x] Allow Multiple Lines
[x] Limit Lenght to Visible Area.
and in the "Layout" under height:
"9mm" / Expand to fit.
This works fine until I use a button that populates this field with content from another two fields:
Script in the Click event of a button:
var something = TextField2.rawValue + TextField3.rawValue;
TextField1.rawValue += something;
The above two lines "do not care" about the script of TextField1 in the Full event.
Is there a way to check if the "TextField1.rawValue += something;" will cause the TextField1 to overset the text and display an alert instead?
The LCD version i'm using is: 9.0.0.2.20101008.1.734229
Many thanks for your help

Hi,
you can combine several object properties to create a text field, with a min/max size that will grow in a limited way.
Paste this code directly into the XML source.
<field name="textField" y="1.15mm" x="1.15mm" w="66.675mm" minH="9mm" maxH="18mm">
            <ui>
               <textEdit multiLine="1" hScrollPolicy="off" vScrollPolicy="off">
                  <border>
                     <edge stroke="lowered"/>
                  </border>
                  <margin/>
               </textEdit>
            </ui>
            <font typeface="Arial"/>
            <margin topInset="0mm" bottomInset="0mm" leftInset="0mm" rightInset="0mm"/>
            <para vAlign="middle"/>
            <caption reserve="25mm">
               <para vAlign="middle"/>
               <value>
                  <text>Text Field</text>
               </value>
            </caption>
         </field>
You'll see a warning in Designer that the limit to visible area feature won't work, but it works for manual input.
For inputs by scripting the overflowing text won't be visible and indicated by the plus sign in the text fields end.

Similar Messages

  • Maximum number of line items in sales order

    hi,
    Is there a limit on the maximum number of line items that are permitted in a sales order?
    Thanks,
    Shailaja

    Hi
       I think the correct reply would be 999,999 because data type of item number POSNR is NUM 6, which means that it can hold upto value 999,999.
         However, at the same time keep the following into consideration:
    1. FI document has a restriction of 999 line items per document. So, depending on the account settings, there will be a lower limit. E.g. if each Sales order line item results in 2 line items in the accounting document, then the max. no. of SO line items is limited to 499.
    2. If FI summarization is active, then the system summarizes the account postings, thus reducing the no. of FI line items. Hence, a SO can accomodate more than 999 line items. However, this means that certain line item level details will not be available to the Finance guys (which they may not like).
    3. As the number of line items in a Sales order increases, the system performance suffers greatly. There are performance fixes available, but in general, it is painful to load a SO with large no. of line times through BDC's. 10 Sales orders with 100 lines each consume less system resources than 1 Sales order with 1000 lines.

  • Limit number of lines

    I know how to limit the number of characters that a user can
    input, but is there a way to limit the number of lines that a user
    can input into a textbox.

    Firstly thanks kglad and KnowMind for your responses.
    Why I wanted this. I have a textfield that a user fills in.
    This text is then displayed in another textfield that can't be
    scrolled at a later point. Therefore I need to limit the number of
    lines that they use when filling in the first textfield so that it
    will be fully displayed in the later textfield.
    knowmind, your code works, but doesn't do what I wanted. as
    it increases the size of the textfield being filled out, rather
    than limitting it.
    kglad (as usual) you have done what I wanted, however if a
    user tries to edit his work, eg, goes back to the top line and
    clicks enter any line that goes over the height is lost and can't
    be retrieved, which would be annoying. Therefore instead I am going
    to use the following code:
    commentTxt.maxChars=420;
    remForcedLines = commentTxt.text.split("\r").join(" ");
    It simply removes any forced lines that are in textfield 1.
    Therefore as long as maxChars is under the maxchars in textfield 2,
    it will display fully. Obviously this wouldn't be particularly
    practicle for large textfields but as you can see it is only 420
    chars long.
    So thanks to both of you for your help. J.

  • Determine the number of lines of textfield or floating field

    Hi,
    Is there a way to determine the number of lines of text in a textfield or in a floatingfield.
    My problem is that I'm creating a form with three tables(made of subforms) underneed each other that needs to be set to hidden when the total of rows is greater than 25.
    Now it would be easy to just count the rows but these rows can exist of multiple lines of text.
    The fields of my row are floating fields so when the text is bigger than the displayable width the text continous on a new line in the same row. So I need to know when this happens because now I can show only 24 rows.
    I tried counting the characters but this doesn't work, when there are a lot of 'i,j,l' or other small characters I can place 40 characters in my textfield, but when there are a lot of 'm,w' characters I can place only 22 characters in my field.
    I also tried to use xfa.layout.h(TextField1,"cm") to determine the height of the field, but it always retuns the value -1. I get the same -1 with the y or x - position.
    Does anybody have an idea how to solve this problem?
    Thanks in advance,
    RonnyR

    oops ... i got it thanks.
    code below -----
    for(var i=0; i <= s.length-1; i++)
    sCurrentLetter = s.substring(i,i+1);
    if (s.charCodeAt(i) == 13)
    // this is a line break

  • Limit number of lines in a text editor

    Hello.
    In my program, i'm creating a text zone and i need to limit the data users will put in this zone.
    To create that, i'm using the object cl_gui_textedit. I've looked in the methods of this object but i wasn't able to find one that will limit the number of lines of the text editor.
    Did i miss it ? Does anybody knows how i can for example limit the input zone to 5 lines ?
    Thanks for your help.
    Here's my code
      IF g_editor IS INITIAL.
    *   Instanciation du container pour la zone de texte
        CREATE OBJECT g_textedit_custom_container
            EXPORTING
                container_name = 'TEXTEDITOR'
            EXCEPTIONS
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc NE 0.
    *      add your handling
        ENDIF.
    *   Création de la zone d'édition du texte
        CREATE OBJECT g_editor
          EXPORTING
            parent        = g_textedit_custom_container
            wordwrap_mode = cl_gui_textedit=>wordwrap_at_fixed_position
            wordwrap_position          = 68
            wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
      ENDIF.

    I just notice there is a method SET_HEIGHT but this one is implemented in CL_GUI_CONTROL.
    I tried this :
            CALL METHOD g_editor->set_height
                    EXPORTING height = w_height.
    But in fact, i never enter the method.
    Do i have to create a CL_GUI_CONTROL object ? If yes, how do i link it to the CL_GUI_TEXTEDIT.
    Sorry if some questions mays seem obvious. It's my first object abap program.

  • Maximum number of lines textfield

    Hi everybody !
    I need to set a maximum number of lines on a text field that should be expandable up to that line number and not beyond.
    Who do I know how to do?

    You can control the number of chars in the field, you can limit the field to the visible area but you cannot dictate a number of lines that the field can be. The closest thing you can get is to make  the field the max number fo lines and then use "limit to visible area" so that people cannot add more text.
    Paul

  • Set the number of lines allowed in multi-line text field

    Hi,
    I am designing a form where I have some multi-line text fields where I only want the user to be able to enter a maximum of say 5 lines. I know I could do this by enabling the "Limit Length to Visible Area" option, however, this option is ignored by Reader 7 and the field scrolls, hiding any text that spills beyond the visible area from printouts. It works great in 8 though. To avoid this bug/feature in Reader 7, is there some script that I can use to limit the number of lines allowed in a text field?
    Thanks

    I ran into similar issues switching between Acrobat/Reader. Here is the prominent code that works for me when I use this in "Enter" event of the textField.
    var aSOM=this.somExpression.substr(15,this.somExpression.length - 1);
    var acroField = event.target.getField(aSOM);
    acroField.doNotScroll = true;
    I chose Allow Multiple Lines alone and noting else.
    Good Luck,
    SekharN

  • Maximum number of line items in PO/SA....

    Hi,
    1.
    What is the limitation on maximum number of line items in a PO/schedulling agreement/Contract.
    2.
    Also what is the maximum permissible number of lines in a single accounting document possible.As far as I know there is a limitation of counter 999 meaning if an aaccounting document is generated after GR then it will only allow max 999 lines.
    Is there any other way to avoid this.Because in my case I have for several line items in PO and several pricing conditions with separate GL account.Now when I do GR and if a PO has many line items with about 4 to 5 conditions then for each line item there would be minimum 6-7 entries.
    How can this best be handled in SAP.
    I was being adviced to split the GR but is there any better way or is there any option like summerised acounting document ?
    Please suggest as this is most critical for me.
    Thanks in advance
    Regards,
    manOO

    Hi,
    There is no limitation in PO.  But if you want, you can use following user exit;
    <b>EXIT_SAPMM06E_012</b>
    With regard to Maximum Number of items: There is a limit of (999) line items which can be posted per FI document. This is because the line item number (BSEG-BUZEI) field length is defined as (3) numeric positions, i.e., (999) line items.
    The most commonly used workarounds are as follows:
    (1) Implement FI summarization (per note 36353).
    (2) Cancel the original billing document and split it into smaller documents using different payment terms but actually with the same terms, in case of invoice verification.
    This will avoid the (999) line item limit for FI postings. Please also have a look at the note 117708 and 77161.
    Bye,
    Muralidhara

  • I want to be able to paste a bunch of text into the subject line buit to only keep the first maybe 50 characters. How can I limit the size of the subject line?

    I need the ability to paste a bunch of text into the subject line but for it only to capture the first 50 or x number of characters. Can I limit the size of the subject line characters somehow in an ini or profile setting?

    If your problem is with Mozilla Thunderbird, see this forum for support.
    [https://support.mozillamessaging.com/en-US/home] <br />
    or this one <br />
    [http://forums.mozillazine.org/viewforum.php?f=39]

  • AutoSize not working properly in TextField when using non-zero line spacing

    When using non-zero line spacing, the autoSize property is not functioning as expected, causing text fields to scroll that shouldn't.  Also, when using device fonts, the sizes of the TextFields are wrong in the Flash IDE.
    I have a TextField whose height is supposed to be dynamic, depending the width of the TextField.  wordWrap is true, the text is left aligned, and the autoSize value is flash.text.TextFieldAutoSize.LEFT.
    When the TextField's width is adjusted, the height increases or decreases as expected, but when I scroll the mouse wheel over the TextField, it allows a single line to scroll out of view.  This should not be happening.  The autoSize property should ensure the TextField is large enough to neither require nor allow scrolling.
    Has anyone else encountered this issue or know how to fix it?
    Update: Been a problem since at least 2006! > http://blog.nthsense.net/?p=46
    http://www.kirupa.com/forum/showthread.php?288955-Disabling-textfield-scrolling   Bug is caused by using a line height ("line spacing" in Flash) larger than zero, for example 1.0pt.  It looks like when I reduce the line spacing of the text field to zero, the issue goes away.  There doesn't seem to be anything wrong with how autoSize is calculating the required height of the text (i.e. it is exactly textHeight + 4 pixel gutter, and drawing the rectangle (2,2,textWidth,textHeight) aligns visually with the text), so it must have to do with how the TextField is deciding whether it needs to scroll or not, and that separate calculation is being thrown off by the non-zero line spacing.  The additional non-zero spacing at the end of the last line could be making the TextField think it needs to scroll, even though it's hight is sufficient at "textHeight + 4".  Apparently the problem manifests when using a non-zero leading value as well.
    In fact, it has to be related to the leading value exactly, since the following code stops the textfield from scrolling.
    //body is TextField
    var tlm:TextLineMetrics = body.getLineMetrics(body.numLines - 1);
    trace(tlm.leading); //traces "1" here.  traces zero when line spacing is zero, and traces larger values with larger line spacing values
    body.autoSize = flash.text.TextFieldAutoSize.NONE; //turn off autosize so the height can be set manually
    body.height += tlm.leading; //increase height of textfield by leading value of last line to cause scrolling to be turned off.
    Honestly, this is pretty unacceptable bug.  First of all, scrolling should not be sensitive to trailing line spacing, because autoSize and textHeight do not include it. It need to be consistent, and I think textHeight and autoSize setting height = textHeight + 4 is correct.  Vertical scrolling should use textHeight as it's guage for whether scrolling is necessary, but instead, it's obviously involving the leading values of the last line.  At the very least, vertical scrolling should simply be disabled when autoSize is turned on and wordWrap is true, because the TextField should be big enough to fit all the text.  The workaround of manually adjusting the height is also no good, since turning autoSize back on will immediately change the size back and trigger scrolling again.  I also shouldn't have to set line spacing to zero just to use the autoSize feature, since the scrolling calculations are wrong in this way.

    No, lol.  Luckly, I replace most of my TextFields on the display list with my subclass TextFieldEx.  I just call a clone method that accepts a TextField and returns a TextFieldEx with identical properties.
    I corrected the problem via modifying the subclass to behave differently when autoSize is not NONE and wordWrap is true.  Under those conditions, the maxScrollV and scrollV property values are fixed at 1, and the class listens for its own SCROLL event and sets scrollV to 1 when it occurs.  That allows me to leave everything else alone, including text selection, and use whatever line spacing I want.
    The modification seems to work fine so far.
    For anyone interested in doing something similar, here is a clone method that will copy a TextField.
    public static function clone( t:TextField ):TextFieldEx
                                  var te:TextFieldEx = create( "", t.width, t.type, t.multiline, t.wordWrap, t.selectable, t.embedFonts, t.defaultTextFormat );
                                  te.alpha = t.alpha;
                                  te.alwaysShowSelection = t.alwaysShowSelection;
                                  te.antiAliasType = t.antiAliasType;
                                  te.autoSize = t.autoSize;
                                  te.background = t.background;
                                  te.backgroundColor = t.backgroundColor;
                                  te.blendMode = t.blendMode;
                                  //te.blendShader = t.blendShader;
                                  te.border = t.border;
                                  te.borderColor = t.borderColor;
                                  te.cacheAsBitmap = t.cacheAsBitmap;
                                  te.condenseWhite = t.condenseWhite;
                                  te.displayAsPassword = t.displayAsPassword;
                                  //te.embedFonts = t.embedFonts;
                                  te.filters = t.filters;
                                  te.gridFitType = t.gridFitType;
                                  te.height = t.height;
                                  te.opaqueBackground = t.opaqueBackground;
                                  te.restrict = t.restrict;
                                  //te.selectable = t.selectable;
                                  te.sharpness = t.sharpness;
                                  te.thickness = t.thickness;
                                  te.transform = t.transform;
                                  //te.type = t.type;
                                  te.useRichTextClipboard = t.useRichTextClipboard;
                                  //te.wordWrap = t.wordWrap;
                                  //Assign text last
                                  te.htmlText = t.htmlText;
                                  return te;
    //And the create method it uses
    public static function create( text:String = "", width:Number = NaN, type:String = null, multiline:Boolean = false, wordWrap:Boolean = false, selectable:Boolean = true, embedFonts:Boolean = false, font_or_textformat:*=null, size:Object=null, color:Object=null, bold:Object=null, italic:Object=null, underline:Object=null, url:String=null, target:String=null, align:String=null, leftMargin:Object=null, rightMargin:Object=null, indent:Object=null, leading:Object=null ):TextFieldEx
                                  var tf:TextFieldEx = new TextFieldEx();
                                  tf.width = isNaN(width) ? 100 : width;
                                  tf.defaultTextFormat = (font_or_textformat is TextFormat) ? (font_or_textformat as TextFormat) : new TextFormat( font_or_textformat as String, size, color, bold, italic, underline, url, target, align, leftMargin, rightMargin, indent, leading );
                                  tf.embedFonts = embedFonts;
                                  tf.multiline = multiline;
                                  tf.wordWrap = wordWrap;
                                  tf.selectable = selectable;
                                  tf.type = type;
                                  tf.text = text; //setting text last ensures the text line metrics returns correct values
                                  //Initialize the TextField's size to fit the text.
                                  if (!multiline)
                                            //When in single-line mode and no specific width is given,
                                            //expand width to entire line.
                                            if (isNaN(width))
                                                      tf.width = tf.textWidth + 4; //match width of text
                                  //Height is always automatically adjusted to fit the text by default.
                                  //It's better than the arbitrary 100px default height.
                                  var minimum_height = tf.getLineMetrics( 0 ).height;
                                  var h:Number = tf.textHeight;
                                  tf.height = (h < minimum_height) ? (minimum_height + 4) : (h + 4); //match height of text, ensuring height is at least enough to display one line, even if there is no text
                                  return tf;

  • Number of lines in a Field of type Text with Javascript

    Hi,
    I have a form where I need to dynamically retrieve the number of lines in a Field of type Text.
    When I use getField(), I'm returned an object of type Field. I can see such properties as rect, but nothing concerning the number of lines of text in the field.
    Any idea (other than getting the Field height and dividing that by the height of a line) ?
    Regards,
    Karl.

    Hi,
    You can use below function to calculate the no of lines in the Text field dynamically.
    import mx.controls.textClasses.TextRange;
        import flash.text.TextField;
        private function calculateNoOfLines():int
          var tr2:TextRange = new TextRange(_text, true, 0,_text.text.length-1);
          tr2.text = _text.text;
          _text.invalidateSize();
          _text.invalidateDisplayList();
          _text.invalidateProperties();
          var contentTextField:TextField = _text.mx_internal::getTextField();                           
                  var nLines:int = contentTextField.numLines;
                  var lineMetrics:TextLineMetrics = _text.getLineMetrics(0);
                  // This is to calculate the total text height
                  var _textHeight:Number = lineMetrics.height * nLines;
         return nLines;    
    Call the above function in the KeyUp event of the Text field.
    Here in the above field _text is the Text field.
    <mx:Text id="_text" />
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

  • Number of lines in SAP B1 2007A

    Hi all.
    We have a client that use SAP B1 2007A on a SQL server 2005. The sometimes make very big sales quotations which exists of maybe 3000 rows. To my understanding, there is documentation saying there is no limitations on amount of rows it only affects performance. What would be the acceptable performance (measured in time) when adding line number 3001 on a sales quotation?
    For our install, we wait maybe 20 seconds for adding the item and then we wait maybe 1 minute when updating the sales quotation. We are running on a machine with 4 processors and 4GB RAM.
    Does anyone have some other experiences on this field?
    Best regards, Runar Wigestrand.

    Hi Runar,
    A 3000 line quote is too much for B1 to handle. The scenario you mentioned if not the worst in that amount of data. Although it is no limitations on amount of rows, the performance is the LIMIT.
    Even if your client upgrade their hardware to double the performance, it will still be painful.
    Better if they can change their current business process.  I think the number of line can be trimmed if they set up item correctly.
    Thanks,
    Gordon

  • What is the maximum number of line items we can enter in an order...

    Hi,
       Can anyone explain what is the max number of line items that v can enter in an order....
    or if i want to increase the number of line items than the max where it is controlled.
    Because my mm counter part is facing this in the PO he could make only 9999,the problem is when posting...the accounting document is not getting generated bcas of exceeding the limit.
    venugopal

    hi,
    this is my personal experiance that we can enter at the most 499 line items in SALES ORDER.
    This is because for every line item there will be 2 financial entries, debit and credit. and 1 FI document can have at the most 999 line items (which we can not increase without KEY fromSAP)
    If we divide 999 by 2 then it comes to 499.50 so you can enter at the most 499 line items in Sales order.
    Regards
    Vishal

  • Manual posting at level 20 - number of lines available in cons monitor

    Hello,
    I have a question concerning manual postings. We have created a document type and a task for manual postings connected to intercompany eliminations (posting level 20). In the monitor, the users only have 10 lines available for the manual posting and I have not been able to figure out how to increase the number of lines. Has anyone else been able to get more than 10 lines, or is that a limit?
    Thanks in advance!
    Kerstin

    Well, that would be great - but I tested it and I couldn´t make it work? I will try this with my customer again tomorrow, if we can´t make it work I hope it´s OK if I get back to with a follow-up question?
    Kind Regards,
    Kerstin

  • Maximum number of lines in Al11 for csv and txt files

    Hello Experts,
    I need to extract millions of records to a file in AL11 from several DSO - based on fiscal period and year. Can anyone tell me about the maximun number of lines a csv and txt file can hold in AL11.
    Points will be assigned.
    Kevin.

    Hi.
    As per my knowledge there is no limit for text files but for csv file its 1048576 rows.
    Hope this helps.
    Regards
    Sai

Maybe you are looking for

  • E65 modem: "A device attached to the system is not...

    I am not able to resolve the following problem which suddenly appeared. When I try to connect to the Internet, both bluetooth and USB modem say: "Error 31 A device attached to the system is not functioning" when connecting directly using a dial-up co

  • How to convert the character value to currency/numeric

    Hi, See the sample code here data: v_qtr_field(7). data: w_low_limit like glt0-kslvt,       w_amount like glt0-hslvt. w_low_limit = 02. w_max_period = 3. concatenate 'HSL' w_low_limit into v_qtr_field. *comment *I am looking for a field formation thr

  • Mac Pro boot from SAN - Can we do it?

    I am looking to put a Mac Pro in a data center.  I would like to set it up to boot from our SAN.  I've seen very little information on this possibility.  Ideally my configuration would look like this: Mac Pro - dual fibre channel adapters - boot from

  • How do you tell if the remote sim is active on a N...

    I'm trying to link my nokia 8800 with the in car bluetooth and the instruction says the remote sim needs to be active on some nokia phones

  • Clearing through F.13 in special posting period 13

    Hi Gurus, I wanted to clear the transactions through F.13 with special posting period 13.  The message shows F502 : "Posting period 012 2008 is not open". Our Financial year is : 2008 ( April 2008 to March 2009) In OB52 We have closed the posting per