How to restrict the text field to enter only numbers???

I have used "onkeyup" event to call a function "test", I am getting the alert message for every entry (even for a number), I dont know why I am getting this. Please help me out.....
Number1 : <input type="text" name="myin1" id="a" onkeyup="test(this,event)">
function test(ff,evt)
evt = (evt) ? evt : event;
var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode :
((evt.which) ? evt.which : 0));
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
alert("Only numbers are allowed"); }
}

Hi,
However this is java forum and you are asking for a solution of a javascript problem,
I think I got the problem.
This script works fine when I run it on IE and use the numeric keys above the text keys,
but give error when I use the numerical keypad on the right.
I think you should change your if condition like this
if (charCode > 31 && ((charCode < 48 || charCode > 57) || (charCode < 96 || charCode > 105)) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • How to populate the TEXT field in MIGO

    Hi folks,
    While creating material document in MIGO or MB01, i am inserting some data in TEXT ( Field in line item level ). This text data is disappearing , once mat doc is created.
    how to populate the TEXT field in MIGO?Is there any cusomisation?it's urgent .
    Regards
    pabi

    Hello Pabitra,
    I had a similar issue in my Project.
    Please verify if the SMOD enhancement MBCF0002 (EXIT_SAPMM07M_001) is active in your system.
    If this is the case, verify from two angles:
    a) Whether the Enhancement was accidentally activated - If yes, then De-activate the same
    b) If there is some logic coded in the User Exit, but, the Text is somehow not determined...even the existing content in the text field (input to EXIT_SAPMM07M_001) will get vanished.
    Hope that your problem will be resolved by this.  Pls reward points.
    With Regards
    Vijay Gajavalli

  • How to keep the Text Fields in Nested Subforms together?

    Please find the structure of nested subforms as below:
    --Subform 1
        --Subform 2 {Subform 2 is repeatable}
          Text Field 1
            --Subform 3 {Subform 3 is repeatable}
              Text Field 2
            --Subform 4 {Subform 4 is repeatable}
                  Text Field 3(Header)
                --Subform 5 {Subform 5 is repeatable}
                  Text Field 4(Data) 
    I want to keep the Text Field 2, Text Field 3 and Text Field 4 together.
    I am able to keep the Text Field 3 and Text Field 4 together by checking Keep with next and checking Allow Page Break. But checking Keep with next and checking Allow Page Break for Text Field 2 doesn't help in keeping all the three Text Fields together.
    Can anyone please tell me how do I keep all the three Text Fields (2, 3 & 4) together?
    Please mail me at [email protected] for any solutions. Thanks.

    It would be easier to answer by looking at the form settings.
    You can send the form to [email protected] so I can have a look at it.
    Thanks
    Srini

  • How to disable the text field in File upload element?

    Hi,
    How can we disable the text field in the "File upload" UI element so that the user won't be able to type the file path there, but he will still be able to browse the file using the Browse button?
    Regards
    Praveen

    Hi Praveen,
    This is not possible with the Web Dynpro File Upload UI element.
    Thanks,
    Samta

  • How to enlarge the Text field?

    Hi Gurus,
    Can it possible to enlarge the text field in f-43 screen.Presently the text field is limited with 50 characters,i want it be 75 or 80 characters to display the whole text in print outs of the invoice.If i ask the access key to my basis consultant and change the field to 75 characters(now it is 50) then ll it put impact in any other pragrammes or screens??
    Please suggest.
    Regards,
    Sumeya Offrin

    Hi Sumeya,
    We are not sure, where else the domain(text50) and data element(SGTXT) is being used in SAP. There could be so many objects using this domain. All the objects would be effected, if you change this.
    The side effects of this could be like, when you upgrade your service pack levels or patches, system may throw short dumps or syntax errors. Please take the advise of an ABAPER, before changing the field length.
    Pls go through the below links, which could help you.
    CHANGING STANDARD DOMAIN FIXED VALUES
    Change the SAP field Length
    Re: changing filed length
    Regards,
    Praisty

  • How to make the text fields as mandatory (in 'notes and attachment' tab)?

    Hi,
    We have defined some Fixed Values for texts under IMG>SRM>SRM Server>Cross Application Basic Settings>Text Schema>Define Fixed Values for Texts, for a certain transaction type of RFx responses for a text schema.
    Because of this, the bidder can choose one of these fixed values for texts. This is perfectly working fine.
    Now the question is, we want to make the texts fields as mandatory. i.e. The bidder should not be able to submit the responses if certain texts are blank.
    Is there be any BadI for this?
    GH

    You can use BBP_DOC_CHECK_Badi for this field validation using a filter value RFx/Bid (I ont remember exact word).
    Regards,
    Jagadish.

  • How to Validate the Text Field in JSF

    Hi,
    I am facing a issue to validate the text field where the below code accepts (space' ',underscore'_',pipe'|') symbol as a first character and last character.Where by it can accept in the middle.
    It should not accept special characters also. Below code is working properly for special characters.
    <tr>
    <td width="30%" align="right"><b><h:outputText id="aAccrualType" value="Accrual Type" /> </b> <span style="color:red">*</span></td>
    <td width="50%">: <h:inputText id="accrualType" value="#{accrualTypeMast.accrualType}" required="true" >          
    <t:validateRegExpr pattern="^[(a-z)||(A-Z)||(0-9)||(_)||(\s)||(/)]+$" />     
    <f:validateLength minimum="1" maximum="50"/>     
    </h:inputText>
    <h:message for="accrualType" showDetail="true" style="color:red" />
    </td>
    </tr>
    The thing is i dont have much knowledge in regular expression.
    Is there any other way to do this.
    Could anyone help me in this.
    Thanks,
    Ambika&#9786;

    This has nothing to do with JSF.
    I suggest you to read the Pattern API documentation [1]. You can easily create a small Java Application and test the regexp using String#matches() as it uses the same regexp guidelines.
    public static void main(String[] args) {
        String regexp = "^[a-z]+$";
        String value = "foo";
        boolean match = value.matches(regexp);
        System.out.println(value + " matches " + regexp + ": " + match);
    }[1] http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

  • How to resize the text field through the expression?

    It is necessary that another layer was at 150 pixels to the right of the right side of the text field.

    PACK
    Syntax
    PACK source TO destination.
    Effect:
    This statement, which is forbidden in classes, converts the content of the data object source to the data type p of length 16 without decimal places. In contrast to the conversion rules for elementary data types, a decimal separator in source is ignored. This assigns the converted content to the data object destination.
    The data type of source must be character-type, flat, and its content must be interpretable as a numeric value. The data type of destination must be flat. If destination has the data type p, the interim result is assigned to it from left to right. Surplus characters are cut off on the left, and the decimal places are determined by the data type of destination. If destination does not have the data type p, the interim result is converted to the data type of destination according to the rules in the conversion table for source field type p.
    Notes:
    The function of the statement PACK is based on the second half-byte of the code corresponding to a character in most character representations of the BCD representation for the corresponding numeric value. This compilation is generally known as "packing".
    If the source field contains a number without a decimal separator, and the target field has dobj2 of data type p with sufficient length and without decimal places, the result of the PACK statement (which is forbidden in classes) corresponds to the result of the statement MOVE.

  • How to convert the text field into currency field

    Hi,
    I have an requirement to converting the text field into currency.
    If I convert directly it gives dump.
    If I convert this to Numeric means it takes the decimals also as whole value.
    Is there any FM to convert the text field into Currency field.
    Please advice me.
    Thanks in advance.

    Hi,
    I am on an SRM sytem, which unfortunately does not have th FM: PSSV_TEXT_INTO_FIELD_CURRENCY.
    But I also need to transfer a string value like '12,99' to a field with type curr.
    Can i Do that manually, or is there another FM?
    I have already checked code with write to or pack/unpack.
    But without success yet.
    Something like this:
    DATA: g_str(11) type c.
    DATA: g_p type p.
    WRITE '12,99' TO g_str CURRENCY 'EUR'.
    is no use for me. Finally I need to move g_str to my curr-field, which causes st22.
    also: PACK g_str to <curr-field or g_p> dumps.
    Help appreciated.
    regards, matthias

  • How to set the text of a cell in Numbers to vertical direction? Tks.

    Hi
    In Numbers, please tell me how to switch the text of a cell to vertical direction?
    Tks.

    Hi Kyle,
    In Numbers, nothing having to do with a table can be rotated. (In Pages an entire Table can be rotated, but not text within a Table.)
    There have been many suggestions posted here over the life of iWork for vertical labels. Most fall into three categories:
    1. Type one letter, Option-Return, type another letter, Option-Return, and so forth.
    2. Type label in a Text Box, rotate the box, position the box over the table, covering the cell where you need a label.
    3. Create a PDF graphic with rotated text and insert it into table cell as Background Fill.
    The third option is clearly the best. The steps for option three are:
    Insert Text Box
    Type label into the box
    Rotate the text box
    Select the text box (not the text inside the box)
    Command-C
    Switch to Preview.app
    Command-N
    Command-C
    Switch to Numbers
    Click on Cell where the label goes
    Command-V
    It sounds worse than it is. You can reuse the Text Box so you don't end up with a sheet full of them.
    Regards,
    Jerry

  • How to calcaulate the text field data

    hi frnds need help,
    how to find difference bet time if i taking  the data  from texts fields data i.e long text
    i called the FM & passed the parameters
    of text data but iam gettin answer as zero
    i hope ur gettin my point

    Hi
    You have to use READ_TEXT fun Module to fetch the Long text data by passing the correct paramters like OBJECT,ID,OBJECTNAME and LANGuage fields
    see the doc
    READ_TEXT
    READ_TEXT provides a text for the application program in the specified work areas.
    The function module reads the desired text from the text file, the text memory, or the archive. You must fully specify the text using OBJECT, NAME, ID, and LANGUAGE. An internal work area can hold only one text; therefore, generic specifications are not allowed with these options.
    After successful reading, the system places header information and text lines into the work areas specified with HEADER and LINES.
    If a reference text is used, SAPscript automatically processes the reference chain and provides the text lines found in the text at the end of the chain. If an error occurs, the system leaves the function module and triggers the exception REFERENCE_CHECK.
    Function call:
    CALL FUNCTION 'READ_TEXT'
    EXPORTING CLIENT = SY-MANDT
    OBJECT = ?...
    NAME = ?...
    ID = ?...
    LANGUAGE = ?...
    ARCHIVE_HANDLE = 0
    IMPORTING HEADER =
    TABLES LINES = ?...
    EXCEPTIONS ID =
    LANGUAGE =
    NAME =
    NOT_FOUND =
    OBJECT =
    REFERENCE_CHECK =
    WRONG_ACCESS_TO_ARCHIVE =
    Export parameters:
    CLIENT
    Specify the client under which the text is stored. If you omit this parameter, the system uses the current client as default.
    Reference field: SY-MANDT
    Default value: SY-MANDT
    OBJECT
    Enter the name of the text object to which the text is allocated. Table TTXOB contains the valid objects.
    Reference field: THEAD-TDOBJECT
    NAME
    Enter the name of the text module. The name may be up to 70 characters long. Its internal structure depends on the text object used.
    Reference field: THEAD-TDNAME
    ID
    Enter the text ID of the text module. Table TTXID contains the valid text IDs, depending on the text object.
    Reference field: THEAD-TDID
    LANGUAGE
    Enter the language key of the text module. The system accepts only languages that are defined in table T002.
    Reference field: THEAD-TDSPRAS
    ARCHIVE_HANDLE
    If you want to read the text from the archive, you must enter a handle here. The system uses it to access the archive. You can create the handle using the function module ACHIVE_OPEN_FOR_READ.
    The value '0' indicates that you do not want to read the text from the archive.
    Reference field: SY-TABIX
    Default value: 0
    Import parameters:
    HEADER
    If the system finds the desired text, it returns the text header in this parameter.
    Structure: THEAD
    Table parameters:
    LINES
    The table contains all text lines that belong to the text read.
    Structure: TLINE
    Exceptions:
    ID
    The text ID specified in the parameter ID does not exist in table TTXID. It must be defined there together with the object of the text module.
    LANGUAGE
    The parameter LANGUAGE contains a language key that does not exist in table T002.
    NAME
    The parameter NAME contains the name of a text module that does not correspond to the SAPscript conventions.
    Possible errors:
    The field contains only blanks.
    The field contains the invalid characters ‘*’ or ‘,’.
    OBJECT
    The parameter OBJECT contains the name of a text object that does not exist in table TTXOB.
    NOT_FOUND
    The system did not find the specified text module.
    REFERENCE_CHECK
    The text module to be read has no text lines of its own but refers to the lines of another text module. This reference chain can include several levels. For the current text, the chain is interrupted, that is, one of the text modules referred to in the chain no longer exists.
    WRONG_ACCESS_ TO_ARCHIVE
    The exception WRONG_ACCESS_TO_ARCHIVE is triggered if an archive is accessed using an incorrect or non-existing archive handle or an incorrect mode (that is, read if the archive is open for writing or vice versa).
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • How to get the text field in the header for only first page of the report

    Hi,
    I am developing reports in BI Publisher Enterprise where i am facing problem i.e., i have to get some text field in header,for only first page in the result but it is displaying in all the other pages of the report in result.So,please if you have any idea of how to solve it, please reply.It is required as early as possible.
    Thanks in Advance

    Invalid path? What are you doing? Writing the report output to an invalid directory?
    Where are your terms and conditions? It would be very easy just to put them in a database table and select them in your report query.

  • How to restrict the functions in People Enter and Maintain - Others LOV

    I want to restrict the functions appearing when i click on People Enter and Maintain -> Others screen.
    Can this be done through form personalization ?
    If not how can this be achived.
    I want to restrict the list in Assignmnet -> Others list also.
    Thanks in advance
    -Debojyoty

    Change the underlying taskflow.
    In the form function parameters, you can find the taskflow name for the WORKFLOW parameter.
    Make a copy of the seeded taskflow and add/remove nodes as you wich.
    4 nodes in a taskflow can be checked to appear as a button, if you have more nodes linked to the form, they will appear under the other button.
    This is configuration, no customization or personalization!

  • How to change the text field typestyle in InDesign 6 forms

    I am designing a form in Indesign CS6. I would like to change the typestyle in my text fields. It seems to default to Times Roman. I want to change it to Ariel. Any suggestions on how to do this. I do not want to have to do it in Acrobat.

    You can't do that in InDesign, unfortunately, so you'll have to make changes in Acrobat after exporting to PDF. With scripting you have the opportunity to automate this. Post again if you'd like more info.
    Also, I would strongly advise against using Arial and use the built-in Helvetica instead. Acrobat/Reader actually use a version of Arial when Helvetica is specified. If you specify Arial, it will embed the entire font, resulting in a sigificant and unnecessary increase in file size.

  • How to restrict a text field to accept limited number of digits (only) with leading zeroes

    I am trying to restrict a field for accepting only limited number of digits that can have zeroes in the begining - this why I can't use Numeric field. Can anybody help?

    Hi Niall,
    Thank you very much,
    I did something like what you told me - thought I used script in ordetr to prevent entering any chracters except digits.
    In Change event I enterd the following script:
    // Restrict input to digits only - Number of digits (characters) assigned in Object Palette - Field Tab
    if((xfa.event.change != 1) && (xfa.event.change != 2) && (xfa.event.change != "3") && (xfa.event.change != "4") && (xfa.event.change != "5") && (xfa.event.change != "6") && (xfa.event.change != "7") && (xfa.event.change != "8") && (xfa.event.change != "9") && (xfa.event.change != "0"))xfa.event.change
    = "";
    This does the job.
    Thank you,
    Peter.

Maybe you are looking for

  • I want to report a problem an IN app purchase i did not order

    I was charged for an IN -App purchase I did not order or want .It was purechased on my Itunes store credit.How do i get my credit Refunded.Thanks

  • Jumpy Mouse Behavior

    As of late, I have been having problems with the mouse behaving erratically. Using either a Mighty Mouse or the trackpad, the pointer jumps in erratic, random locations. It subsides after about 30 minutes. I realized this was happening usually after

  • [ANN] yFiles FLEX 1.0 released

    yWorks is proud to announce the official 1.0 release of yFiles FLEX, a Flex™-based framework for web-based diagramming applications. yFiles FLEX allows easy integration of sophisticated diagram visualization, animation and editing functionality into

  • Recent Switcher from XLS needs help on Formatting UPC Codes in Cells

    I frequently need to have 11 and 12 digit UPCs in my cells. Many of them have a leading ZERO. XLS has a way to custom format for them so it does not drop the leading zero or you can put it back if it has been dropped on opening. Is there a way to cus

  • Can't send mail since password change

    Yesterday I changed my yahoo password and now I can receive emails on my itouch but I can't send them - it says the username or password is incorrect. I know they are both correct. I've tried going through settings but when I touch Outgoing Mail Serv