Validation Pattern: requiring decimals

ISSUE ONE:
I want to have users input a number to the nearest hundredth - concerning grade point averages. For instance, if the number is 2.96, I do not want users to input 3.0. They must have two decimal places. How do I do this?
ISSUE TWO:
In reference to issue 1, how do I make sure if they try to input more decimals that it automatically rounds to two? For instance, if the user tries to input 2.9599, I want it to round to 2.96. Can this be done?

Here is the entire solution.....
use a numeric field with data Display Pattern, Edit Pattern and DataPattern similar to zzzzzzzzzzzz9.999
and then have the following JavaScript code in exit event (may have to customize as required).
var val = this.rawValue
this.rawValue = Math.round(val*1000)/1000; //answer for send question
//answer for first question starts here
val = this.formattedValue;
var myDot = val.indexOf(".");
var rDot = val.substring(myDot+1);
//xfa.host.messageBox(""+rDot);
if (rDot == "000") {
xfa.host.messageBox("Integer values are not allowed.");
xfa.host.setFocus(this.somExpression);
Good Luck,
SekharN.

Similar Messages

  • Validation pattern for 4 digit number

    Hi all,
    very simple requirement but I find no solution: Only 4-digit numbers (e.g. 2344 or 2345) should be allowed in a numeric field.
    I try to solve this with a validation pattern. My favorite pattern is "num{9999}". But this pattern validates also 1-, 2- or 3-digit numbers positive. Why? And what is the right pattern?
    Thanks in advance,
    Michael

    I'd make it per skript
    VALIDATION - JAVA SCRIPT
    if (this.rawValue > "999")
    true;
    } else {
    false;
    Limit it to 4 digits (like you've done already) and everything should work fine ^^
    Edit: Probably you should make the field obligatory too (at least if it should be obligatory).
    Hope that helped ^^
    Lisa ^^

  • Problems with date validation pattern DD.MM.YYYY in Form Builder

    (I am using LiveCycle Designer 8.0.)
    My form uses an input date field which consistst of DD.MM.YYYY.
    Display pattern, edit pattern, validation pattern and date pattern has been set to DD.MM.YYYY.
    "Validation Pattern Message"-box has been set to checked.
    "Validation Script Message"-box is not checked.
    1. When I type:      313101
    the system converts the digits to the date 01.01.3131
    2. When I type:      3131
    the system converts the digits to the date 01.01.3131
    3. When I type:       31   
    I get an error message "Date is not valid."
    I need a form to throw an error message if the user doesn`t type the correct input
    DD.MM.YYYY.  (01.03.2009)
    Thanks in advance.
    Tor

    Does anyone have any input on this matter?
    Thanks in advance.
    Regards,
    Tor

  • Validation Pattern Message

    I want to script a Validation Error Message for a field that, on initialize, is in read-only mode. In Designer, when Type = "Read Only" the Validation Pattern and Validation Pattern Message are disabled. I can add script to define the pattern:
    Myfield.validate.picture = "text{99999-9999}|text{99999}";
    and trigger the validation:
    Myfield.validate.formatTest = "error";
    but how can I script the error message that the user sees? Doing the above generates a generic message "Myfield validation failed" but I would like the user to see a more description message, for example "Please enter a 5 digit or 5+4 digit zip code in the format 12345 or 12345-6789".
    It seems silly that I add this field property at design time for a field that is NOT read-only, but not for one that toggles on/off from read-only to enabled. Any suggestions?

    Hi
    You can use the following:
    tfPostalCode.validate.picture.value = "9999";
    tfPostalCode.validate.message.formatTest.value = "An Australian Post Code must be a four digit number!";
    Howard

  • Programatically setting KM property Document Validity Pattern, no method

    I am trying to programatically set the attribute Document Validity Patterns of a KM property.  I am not able to find a method that achieves this.  I can read the Document Validity Pattern, but not set it.
    Can someone help?  My code is shown below:
    IPropertyConfigurationService propConfigService =
                        (IPropertyConfigurationService) ResourceFactory
                             .getInstance()
                             .getServiceFactory()
                             .getService("PropertyConfigurationService");
                   IMetaModel metaModel = propConfigService.getMetaModel();
                   IMetaNameListIterator iterator = metaModel.nameIterator();
                   while (iterator.hasNext()) {
                        IMetaName metaName = iterator.next();
                        String name = metaName.getName();
                        String namespace = metaName.getNamespace();
                        if (namespace.equals(filter)) {
                             String[] documentValidityPatterns =
                                  metaName.getDocumentPatterns();
                             //!!what, no method to set document validity pattern??!!               

    InDesign CS4 (6.0) Object Model says:
     The pattern of dashes and gaps, in the format [dash length1, gap length1, dash length2, gap length2]. Define up to ten values.
    That was it. I guess this is a place where the visual interface diverges from the javascript interface. I was expecting "Start" "Length" as in the dialog. Thanks!

  • Creating Validation Pattern Message (like Designer) in Prof 8

    We aere using Prof 8, and would like to create a Validation Pattern message (with error box checked) similar to a val pattern message created in LC Designer. Is there any way to do it?
    KPanthen, Albany, NY

    Hi
    You can use the following:
    tfPostalCode.validate.picture.value = "9999";
    tfPostalCode.validate.message.formatTest.value = "An Australian Post Code must be a four digit number!";
    Howard

  • Clear/empty entry of field after validation pattern message

    Can anyone help me please with the following:
    Now when user fills a field a validation pattern message shows when entry is not according to validation. BUT...the entry remains.
    Do you know how to remove the entry from the field after clicking OK on the validation pattern message box?

    I don't know how to do that, but I think it would be user abuse to clear out the field. If I mistype a date or an SSN for example, I don't want to have to type it all over again, just correct my mistake.
    Jared

  • How to validate a email address using Validation Pattern?

    Hi,
    is there any document for Validation Pattern? i m looking for a way to validate email addresses in my form.
    it's going to be something like * @ .
    i have no idea of how to do this, or maybe validation pattern is no good? use java script instead?
    any advice is appreciated!
    thanks.

    Hi erv2,
    You just need to place this script in the "exit" event of the field that u r using for email address.
    var r = new RegExp(); // Create a new Regular Expression Object.
        r.compile("^[a-z0-9_\\-\\.]+\\@[a-z0-9_\\-\\.]+\\.[a-z]{2,3}$","i");
    if( this.rawValue == null || this.rawValue == "")
    else
    var result = r.test(this.rawValue);                                              
    if (result == true) // If it fits the general form,
         true;               
    else
          xfa.host.messageBox("Please enter a valid email address ");
          this.rawValue = "";
          false;               // fail the validation.
    Thanks
    Amita
    Edited by: amita arora on Jan 20, 2009 10:44 AM

  • CFINPUT Reg Expression Validation Pattern Help

    I've got a form with a non-required field that needs to meet
    some validation requirements (Numbers, Letters, 'space character'
    or 'blank, empty string' only) if the user chooses to fill it
    out...
    I'm using CFINPUT tag with the following settings, does my
    Reg Expression pattern look OK?
    REQUIRED="No"
    VALIDATE="regular_expression"
    PATTERN="^[a-zA-Z *]{1,40}$"
    MAXLENGTH="40"
    Thanks for any help. I'm v. new to regular expressions (10
    hrs education at Google Univ.)
    Sincerely,
    Paul Cross

    I think you want something more like this:
    ^[a-zA-Z0-9 ]{0,40}$

  • Spry validation textfield - required condition

    Can anyone help me with the Spry validation text field...
    I have a form for which I wish to be able to use for 1 to 4
    users to fill in, if at the beginning of the form they select 2
    users then I wish to then change the 'isRequired:false' to
    'isRequired:true' so that the details for user 2 then become
    required before the form submits... Is there a way I can do this?
    Thanks

    ...plz help me..

  • Pulling validation pattern from XML schema in LCD

    Hi team,
    We have deisgned a fillable PDF form uding Live Cycle Designer ES2.
    The form contains fields of different data types.
    We have created a data connection on the form (using LCD) to bind it to a XML Schema
    The XML schema has different types of validations for different data types.
    When we treid to bind the XML schema to PDF form using LCD, most of the validations were pulled in. Example, numeric lenghth check, string length check, minoccurs , maxoccurs
    But few validations were not pulled from Schema like Pattern validations on string.
    Please guide us on how to achieve this using LiveCycle Designer ES2.
    Cheers,
    Kavi

    Hi Kavi,
    The pattern from the XML Schema can not be automatically copied across, I assume because of the differences in the XML Schema pattern regex and a JavaScript regex.  If you did use a compatible subset I you could write a macro to add the pattern to the validation event.  One difference is a XML Schema pattern always assumes a ^  and $ to match the beginning and end.  Have you seen this document http://partners.adobe.com/public/developer/en/livecycle/lc_designer_XML_schemas.pdf,
    Regards
    Bruce

  • Is Numeric Validation Failing on Decimals

    We just moved from HTMLDB 1.6 to APEX 3.0.1. A field that used to work fine will now not accept a decimal number. It is a text field. There is an item level validation on that field and the only criteria in it is "IS NUMERIC". If I put in a whole number, it works fine, if I put in a decimal number the validation fails. What has changed?

    The decimal separator has always been a period. Just now I replaced it with a comma and it accepted that as numeric. So I don't know if it thinks 4,5 is 4 and a half, or 4 and 5. The application is in English but has been translated to French (I tried it in French as well and it's the same - periods as decimals make it fail, comma instead of a decimal and it saves fine.) Regardless, what would make APEX think a comma makes a decimal number numeric? A database setting? There is no format mask on the field. I deleted the field and recreated it, same problem.
    My Oracle space was removed awhile ago so I have to request it again - I will put this page up there later if there isn't a simple flag or something that needs to be set to accept decimals to be periods instead of commas.

  • Why is this date{MM-DD-YYYY} not a valid pattern?

    I'm tyring to define a new date pattern, date{MM-DD-YYYY}, in Adobe Desinger 7 and it kept saying the pattern is not valid. Please help.

    Never mind. I got it.

  • Form field validation: All required data lost when clicking browser-back-button!

    Hi folks,
    I have a big problem using the validation text  field components of Spry when the user must click the browser back button (or clicking a history.back()-Link) because he has  entered a wrong CAPTCHA-code!
    Right now, all the data - only in the required fields - not in the optional  fields!!! - is lost and the user has to enter all data once  again;-(
    Does anybody know why only the data in the  required fields is lost? Is there a nice workaround?
    I really  appreciate a quick answer:-)
    Kind regards from cloudy Germany
    Thomas

    rememberFormInputs('frmlogin', 'input-');
    'frmlogin' should be the id of page, not the name. so on your <form> tag, add the id="frmlogin"
    remove the
    // overload alert
    function alert(str) {
         var el = document.getElementById('alert');
         if (el) {
              el.value += str+"\r\n";
    Its really bad practice to overwrite the alert. and inside the rememberFormInputs remove these lines:
    alert('old value remembered: '+old_value);
    alert('setCookie: '+name + ' = '+value);
    and it should work

  • Validating Complicated Required Field

    I am trying to come up with the correct validation scipt for a field that requires 13 characters - either numbers or numbers and x's, but does not allow for dashes, other letters or other characters. It is used for ISBN, and needs to be regulated because the professors cannot seem to grasp what is required. Can anyone help?

    Here you go. Put this in the validate event for your field. It will strip out any characters other than 0123456789xX and then check that the result has 13 characters.
    validateISBN(this.rawValue);
    function validateISBN(s) {
    var rExp = /[^0123456789xX]/gi;
    var strFilteredString = s.replace(rExp, "");
    this.rawValue = strFilteredString;
    return (strFilteredString.length == 13)
    Jared Langdon
    www.jlangdon.ca

Maybe you are looking for

  • How to get the ID of a dimension member in script logic?

    Hi everybody, I am working in some logic scripts and I wonder if exists any option to get the current member ID of a dimension in order to concatenate a string using the member referred and an additional set of caracters such as: MEMBER_ID&"_ccccc".

  • Import Fixed Assets data

    Hi all, I got error msg when i import fixed asset data, the format data already follow the import template. This is the error msg: Time     AppID     ExtID     Sev     Scope     Message 2008-01-29 13:02:55.678      0     BA     ER     CBAMasterDataTr

  • How can i run an application from an external hard drive on my macbook air, since I've got less space on my SSD

    Ive got a 128GB SSD on my macbook Air and i know as time goes on ill eventually run out of space so i want to know if their suggestions on how to run applications like google chrome, Skype etc on an external hard drive with out installing int on my S

  • Get 0 price on a sales order

    Hi, I'm trying to configure a sales order to sales order copy control. I don't want any price to be copied and I want the newly created sales order to be always at 0$. Any suggestions?

  • Saving an Agilent N1996A waveform trace to graphics/Excel files

    Hello, I am new to LabView.  I need to create a VI that will save an Agilent N1996A (CSA) waveform trace to a graphics file (PNG, BMP). The user will enter a filename through the front panel.  The Functions palette has a CSA ReadTrace.VI that sends t