Validate the value of the text field

Hello.

I found this code:

the value of power reactive

var a = this.getField ("Name1");

var two = this.getField ("Name2");

var 3 = this.getField ("Name3");

This feature assembles two field values into one with "and" as a separator.

function concatFields (field1, field2, fieldDest) {}

make sure that all variables are present

If (Field1 & & Field2 & & fieldDest) {}

var fieldVals = new Array();

If (field1.value! = "& & field1.value! = null) {}

fieldVals.push (field1.value);

}

If (field2.value! = "& & field2.value! = null) {}

fieldVals.push (field2.value);

}

fieldDestResult = fieldVals.join ('and');

fill the fieldDest only if it is empty

if(fieldDestResult.value!=''|| fieldDestResult.value!=null) {}

fieldDest.value = fieldDestResult;

//}

}

}

concatFields (one, two, three);

These values to combine text two fields into one (text field nr.3) and put 'and' between the values. It works OK. But what happens if the two values are equal? Then, I need that one value is fill in field Nr. 3. Then. If the field 'Name1' and 'Name2' values are different, the two are combined in "Name3",... If the values are equal, the only one of them will be send to "Name3" on the ground.

How can I do?

Thanks for the reply.

There is no coma have been a period should be. Be the soul of the last four lines:

var Text1 = this.getField("Name1").valueAsString;

var Text2 = this.getField("Name2").valueAsString;

if(Text1 == text2) Text2 = "";

Fill-in = Event.Value (Text1, Text2, "", "and");

Additional code can be added to remove the distinction uppercase / lowercase and trim leading or white end space.

Tags: Acrobat

Similar Questions

  • Validate the text field

    Hello

    One of the column is the editable text field. It should allow only the numeric values + ve and - ve and point example authorized 123.00
    and also the - allowed 123.00. and remove all the other characters.
    I wrote the code following and calling onchage on the text field. But it does no period and values of ve. She accepts only + ve digital raising.

    Please help fix this function. or give me a better solution.
    function checkForNumber(evt) {
        evt = (evt) ? evt : window.event;
        var charCode = (evt.which) ? evt.which : evt.keyCode;
        if (charCode == 46){
          return true;
        }
           if (charCode > 31 && (charCode < 48 || charCode > 57)){
            return false;
        }
        return true;
    }

    Hello

    Try

    function checkForNumber(evt) {
        evt = (evt) ? evt : window.event;
        var charCode = (evt.which) ? evt.which : evt.keyCode;
        if (charCode == 45 || charCode == 46){
          return true;
        }
           if (charCode > 31 && (charCode < 48 || charCode > 57)){
            return false;
        }
        return true;
    }
    

    Kind regards
    Jari

  • How can I validate numeric values in a text field?

    Hello

    Once more, I have a problem.

    I have a field in which the user must enter 10 digits in the model 999999-9999. The field should contain only numbers and must be exactly 10 characters. I have a validation script on the button "print", which prevent printing if required fields are empty or not properly filled out.

    I tried two ways of working this point, and I'm not satisfied with any of them, I can always print despite warning messages and validation scripts.

    1.

    I put the type numeric field, limited to 11 characters.

    Display model num {999999-9999}, change the model num {999999-9999} and validation model num {999999-9999}

    Problems using this solution: when I type 11 digits in the field (ex.12345612345) I get a warning message and 12.345.612

    But when I type 9 digts (e.g. 123456-123 or 123456123) I get no message warning and 000000-0000 or 012345-6123

    If I type alphabetic characters (e.g. 123456 abcd) I get no warning message and 000000-0000.

    2.

    I put the field in the text field, limited to 11 characters.

    The model text {999999-9999}, edit text model {999999-9999} and {999999-9999} model validation

    Now, when I type 11 digits in the field (ex.12345612345) I don't get any warning messages and 12345612345

    When I type 9 digts (e.g. 123456-123) I get no warning message and 123456-123

    When I type 9 digts (e.g. 123456123) I get a warning message and 123456123

    If I type alphabetic characters (e.g. 123456 abcd) I get a warning message and 123456 abcd.

    It works a little better as a text field, but I'm not satisfied at all.

    Someone at - there a solution to this?

    Additional I also want the hyphen to emerge automatically when you type.

    K

    Regular expressions are useful for this type of validation. The code below tf1 is a text field with a maximum length of 12.

    Form1.Page1.TF1::exit - (JavaScript, client)

    If (!) ((this.isNull))) {}

    var FO = this.rawValue;

    \d to match any character in the range 0-9

    regExp var = \d{6}\-\d{5}/;

    If (!) () {regExp.test (tf)))}

    xfa.host.messageBox ("the field must be in the format of 123456-12345.", "Validation", 1);

    }

    }

    {The \d{6}\-\d{5}/ expression tests 6 digits \d{6}, a dash-- and 5-digit \d{5}.

    Steve

  • Getting the text field value?

    How can I get the value entered into the field of action tf_1?

    Let's say I'm going to number 5 in the text field tf_1, how can I receive it for use in the code?five.png

    I would like to store that value in the variable, so that I can work with him in a function.

    Can someone help me? I am already grateful!

    var num:Number;

    calcular.addEventListener (MouseEvent.CLICK, resolver);

    function resolver(Event:MouseEvent): void {}

    NUM = Number (tf_1.text);

    If (num/400 = 0) {}

    trace ("Yes!");

    }

    }

  • How can we make invisible static value in a text field to the OPA

    Hi all

    I have invisible static value in a text field in the OPA.

    For ex: field contains the value 100 while we manage the maintenance should not display the value 100 or make us the text as invisible field. whenever we submit the interview the value should be passed.

    I made the background color of the text in white field, but it reflects all the text fields. I need to make the text of the particular text as invisible field. Can someone give me a solution for it.

    Use two different attributes (the one that is indicated in the interview to the need - for example, as "the id selected user" or whatever the phrase is appropriate) and a different attribute, which is the mapped attribute.  The second attribute must not be on any screen of the interview (by thus "invisible" for the user).  Write a table of rules that concludes that the value of the attribute mapped on is EITHER static value or the selected/expected value according to some logic is appropriate to make a decision in your model of strategy.

  • Check the boxes based on the value in a text field

    Hello.

    I'm building a pdf form in Acrobat Professional X. I want to add JavaScript to two checkboxs to achieve the following objectives:

    If the value of a text field (TLigne) is equal to 61, 64, 66 or 67, the first box (PlanACheck) has the value of the object of an audit.  If the value of a text field (TLigne) is equal to 60, 62 or 63, the second box (PlanBCheck) has the value of the object of an audit.

    I have no other than copy and paste Javascript experience, so I'm not sure I use the right language to research. If anyone can provide guidance, I would be very happy.

    Thank you very much!

    Usually this kind of thing will run the custom calculation of the target field script, but the boxes is not a calculation script, so we'll use the text for field Validation script do, with this code:

    this.getField("PlanACheck").checkThisBox (0, (event.value == "61" | event.value == "64" | event.value == '66' | event.value == "67"));

    this.getField("PlanBCheck").checkThisBox (0, (event.value == "60" | event.value == "62" | event.value == "63"));

  • View the value of a text in the text field B field

    I have a PDF form with 2 layers. Layer 1 has information, a textfield and a button. Layer 2 is a model of certificate. The user enters his name in to a textfield called NameEntry.


    When they hit the button, disappears from the layer 1 - instructions and the box of NameEntry become hidden. Layer 2 is the model certificate and I need a new textfield (which is called NameDisplay) to be filled based on the information entered in the text field NameEntry.


    The answer is simple, I know, is to appoint the two text fields. This does not work for me I need input textfield that will carry the differently (background and border) because of decisions out of my hands vs the NameDisplay who will be no background and no border.

    Any ideas? Thank you!

    Use this custom calculation script:

    Event.Value = this.getField("NameEntry").valueAsString;

  • Get the value of the drop-down list (selectedIndex) and the text field - does not

    Hi all

    I'm trying to find and change the values selected by the user using a drop-down list and text field. Here's the code.

    ChangeRevDetails();
    function ChangeRevDetails(){
    
    
              var myDialog = app.dialogs.add({name:"Enter copyright information"});
    
    
    //    var monthlist = col1.dropdowns.add('myList', undefined, myList);
    
    
              var col1 = myDialog.dialogColumns.add();
              var col2 = myDialog.dialogColumns.add();
      
        col1.staticTexts.add({staticLabel:"Month:"});
              col1.staticTexts.add({staticLabel:"Year:"});
        col1.staticTexts.add({staticLabel:"Rev. no.:"});
        
        var myList = [ "January", "February",  "March", "April", "March", "April", "May", "June", "July", "August", "Sepetember", "October", "November", "December" ];
    
    
         var myMonth = col2.dropdowns.add({stringList:myList, selectedIndex:0, minWidth:100});//{minWidth:100});
         var myYear = col2.textEditboxes.add({editContents:"2013", minWidth:100});   
         var MyRev = col2.textEditboxes.add({minWidth:100});
    
    
        var RevMonth = (myList [myMonth.selectedIndex]);
        var RevYear = myYear.editContents;
        var RevNumber = MyRev.editContents;
        var RevToReplace1 = RevMonth +", "+ RevYear;
        var RevToReplace2 = RevMonth +", "+ RevYear + " Rev. " + RevNumber;
    
    
        var myResult = myDialog.show();
    
    
            if(myYear.editContents == "") //entry is "" 
            { 
            alert("Please enter some text into the contents field."); 
            ChangeRevDetails(); 
            }
            else if(myResult == true) //user entered datas 
            { 
    
    
                alert (RevMonth);
                alert (RevYear);
                alert (RevNumber);
                alert (RevToReplace1);
                alert (RevToReplace2);
    
    
                app.findGrepPreferences = NothingEnum.nothing;
                app.changeGrepPreferences = NothingEnum.nothing;
    
    
                // grep find/change
                app.findGrepPreferences = app.changeGrepPreferences = null;       
                app.findGrepPreferences.findWhat = "[\\l\\u]+?\\s?\\d{4},?\\s+[\\l\\u]+\\.*\\s+\\d+";
                app.findGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item("Back page"). paragraphStyles.item("Legal_7/9");
                app.changeGrepPreferences.changeTo = RevToReplace1;
                app.changeGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item("Back page"). paragraphStyles.item("Legal_7/9");
                app.activeDocument.changeGrep();
    
    
                app.findGrepPreferences = NothingEnum.nothing;
                app.changeGrepPreferences = NothingEnum.nothing;
      
        } 
        else //implies user clicked cancel 
        { 
        myDialog.destroy(); 
        }
    
    
    }
    
    

    The problem is, it does not take the value that the user selects in the drop-down list and the text field. It takes the default value as "January" and the year is '2013' as these two values are given as selectedIndex:0 and editContents: "2013". I compared the coding with a few other scripts work as well, but it does not work. I added several alert boxes to check the value we get.

    In addition, search for it and change also does not work. Please help me on this. Thank you.

    Kind regards

    Bachi. D

    Change the order of dialogresults:

    ...

    var myYear = col2.textEditboxes.add ({editContents: "2013", minWidth:100});})
    var MyRev = col2.textEditboxes.add({minWidth:100});)
    Ditto var = myDialog.show ();
        If (myYear.editContents == "") //entry is «»
        {
        Alert ("Please enter a text in the content field.");
        ChangeRevDetails();
        }
        else //user entered if(myResult == true) datas
        {
    var RevMonth = (myList [myMonth.selectedIndex]);
    var RevYear = myYear.editContents;
    var RevNumber = MyRev.editContents;
    "var RevToReplace1 = RevMonth + ', '+ RevYear;

    "var RevToReplace2 = RevMonth + ', '+ RevYear + 'Rev' + RevNumber;

    ...

    did not have a look for the problem of change to find

  • Set by default to the value of another text field

    I imported a several page PDF in LiveCycle Designer.  I place a text field on each page of the PDF file.  I want the user can click in the text field on the first page and type its value.  Then I want to fill in any other fields of text on other pages.  How do I put the default value of the other fields to make this work?

    You can bind the fields in the object > tab link. Simply, name them all the same thing and change the global default binding.

  • Web page open based on the value of the text field

    I want to open a web page that is based on the value of a text field.  How to bind the value of a text field to a command which will open the web page?

    For example, the value of the text field is: 8 t - EXT

    and the web page I want to open when you press a button is: http://hqms/doc.asp?dn=8T-EXT

    As you can see that the 8 t - EXT is something that a person enters the form and is what is needed to open the web page.  The other text in the link of the webpage is always the same.

    Thank you

    Hello

    In the click event of the button, place the following JavaScript code:

    if (TextField1.rawValue !== null) {
         var vURL = "http://hqms/doc.asp?dn=" + TextField1.rawValue;
         app.launchURL(vURL, true);
    }
    else {
         app.alert("Dear user, please put a code in the text field. Thank you!");
    }
    

    You need to change the object references based on your shape.

    Niall

  • Value of the text field delete after click

    There is a text field with the value "type your name". When click in the text field, the value will be automatically deleted. We type "Adobe", then click on outside. If you still want to type 'cycle' after 'Adobe' (no delete Adobe or retype "adobe")

    Is this possible? How can I get?

    Hello

    The other way to do this is to go to object > palette on the ground and set a display model of the null state.

    See page 2 of the form example here: http://assure.ly/ewrLMo.

    At its most simple requires no script:

    In our example we have script in events enter and exit to change the police, but this step is entirely optional.

    Hope that helps,

    Niall

  • Referring to the value of a text field, not the legend

    How to refer to the value in a text field to make the data entered by the user "BOLD" / no fat without the caption of a field text in bold or not bold?

    Hello

    Two lines should do. The first turn the caption and the "BOLD" value, then the second changes the legend of back to normal:

    TextField1.font.weight = "bold";
    TextField1.caption.font.weight = "normal";
    

    Hope that helps,

    Niall

    Ensure the dynamics

  • Adding (or divide, multiply, etc.) in the text field values

    Hello world

    I'm trying to calculate values in fields of text entered by the user (who didn't accept numbers) as well as the values selected by the user drop-down list boxes. I have a function to a button:

    reviewQ.calcBtn.addEventListener(MouseEvent.CLICK, calcAns);
    function calcAns(e:MouseEvent):void
    {
         reviewQ.calcAns_text.text = "Your calculated result is " + parseInt(Q1.Q1_text.text) + parseInt(Q2.Q2_cb.selectedItem.data) + parseInt(Q3.Q3_text.text) + parseInt(Q4.Q4_cb.selectedItem.data);
    }
    

    Now, all I get is the actual values entered into the text fields and selected in the drop-down list boxes. How can I get the sum of these values to display on my 'calcAns_text.text '?

    Thank you for your help,

    Rafa.

    You have to build your own filtering for values.  If you think that decimal values, then you will need to plan and test for the presence of a comma in a numeric string and then do not use parseInt(); (what creates an integer value), but use instead Number();  You will need to filter the commas in the numbers in the string before creating the value used for the calculation.

  • Getting the value of the text field element

    I was wondering if it was possible-

    I have a text field and a "submit" button. In the button submit, I said it to go to a link (i.e. http://www.oracle.com/). I want to take the information that is in the text field and with the URL concatinate (IE if the APEX was in the text field, I want the button submit to take me to http://www.oracle.com/APEX).

    Is this possible?
    If so, how?

    Thank you
    Tom

    Tom:

    Set the URL in the definition of button as

    javascript:redirect('http://www.yahoo.com/' + $v('TEXT_FIELD_NAME') );
    

    CITY

  • Vibrate the text field.

    Hello

    I have a form and I want when I insert the value into the text field
    and press enter for the field of text even vibrates a little. Is this possible?


    Sarah

    It's really an odd...

    You can do without a timer, just with a loop.

    Try in a when-validate-trigger point:

    declare
    l_item item := find_item ( :system.trigger_item );
    l_x_pos number := to_number ( get_item_property ( 'pam1.num', x_pos ) );
    l_y_pos number := to_number ( get_item_property ( 'pam1.num', y_pos ) );
    
    begin
    for i in 1..13 loop
      if
        get_item_property ( l_item, x_pos ) = l_x_pos
      then
        set_item_property ( l_item, x_pos, l_x_pos + 3 );
        set_item_property ( l_item, y_pos, l_y_pos + 3 );
      else
        set_item_property ( l_item, x_pos, l_x_pos );
        set_item_property ( l_item, y_pos, l_y_pos );
      end if;
     synchronize;
    end loop;
    set_item_property ( l_item, x_pos, l_x_pos );
    set_item_property ( l_item, y_pos, l_y_pos );
    end;
    

    You must play araound with the evolution of the value and depends of the
    coordination system you use. I assume you are using pixels in the example.

    Published by: Magoo on 15.10.2009 12:29

  • Tips: APEX 5 r IR by a dynamic action after the text fields complete

    Hello I hope I can get assistance on this matter and thank you in advance for any information.

    I have an APEX 5 screen, that has 4 fields of entry of text and under this one IR that has these 4 parameters in its SQL where clauses.

    Now if I create a button that submits page or redirects to this page my report can be updated with the values of user entered without problem, basic stuff.  If I create the settings section as a dialog box model once again that I can get the update report as this dialogue submits the page as well as the report can refresh according to closed dialog option.

    What I struggle to reach is to allow the user to enter values in the text fields click on a button called 'submit' and there all stages of implementing dynamic action without page reloading.  I want user to P1_A, P1_B, P1_C, P1_D press on "submit" input, dynamic action that links the values entered into the fields, then fire another dynamic action that updates the State when the button is clicked / modified values what works the best.

    I am struggling to get this to work and I even tried to copy these settings and do them as hidden for example bind input P1_A to P1_A_Hidden by a dynamic action and have the report where clause =: P1_A_HIDDEN, but have not managed to get this working.

    It's possible?  I know its easy to simply send the page and make it work, but I want the experience to be quite uniform for the user and act as you never leave the page.

    I saw on the packages of the app in the chart example.  The bubble chart has a list selector (salary) and the table updates dynamically, it seems so that the process can occur, but I need the user to enter text and not use selection lists.

    My apologies if I missed any, but I can give you more if it helps.

    Concerning

    1972903b-5166-494e-8355-08d9d4006e96 wrote:

    Hello I hope I can get assistance on this matter and thank you in advance for any information.

    I have an APEX 5 screen, that has 4 fields of entry of text and under this one IR that has these 4 parameters in its SQL where clauses.

    What I struggle to reach is to allow the user to enter values in the text fields click on a button called 'submit' and there all stages of implementing dynamic action without page reloading.  I want user to P1_A, P1_B, P1_C, P1_D press on "submit" input, dynamic action that links the values entered into the fields, then fire another dynamic action that updates the State when the button is clicked / modified values what works the best.

    The button simply trigger a unique dynamic action of refreshment on the IR region. Session state for page elements must be processed automatically by specifying them in the property Page to submit Items of the IR region.

    Please ensure that you have updated your forum profile with a recognizable username instead of "1972903b-5166-494e-8355-08d9d4006e96": Video tutorial how to change username available

Maybe you are looking for

  • HP Tablet: Tablet reset open question

    I forgot my password of the hp tablet of me and reset Tablet 5 seconds.After not reset no start my tablet. Please solve my problemI purchased before 4 years this Tablet

  • Crash at startup of Skype

    While I was with Skype, it crashed saying that they no longer and had to close. I immediately tried to reopen, but it crashed before that anything could happen, and that's what he does every time. I tried to install the latest version, and then unins

  • How to play movies from my pc on NSZ - GS7

    On my PC, when I open Windows Media Player, I went to the stream, and I gave permission to access NSZ - GS7 to play media from my pc. But when I go to the NSZ - GS7, I don't know where to go to see the movies on my pc to play on my TV. Thnks!

  • Compressing files with local characters

    Hello community, I will compress files with LabVIEW, but the names of files in the zipfiles be annoying especially since I use English characters such as 'a', 'e' etc. If I zip outside labview then the file names are very well, then I guess it's a th

  • Windows shared printing problems Vista

    I installed a new Vista PC in an office, they have a printer hanging on a PC running also shared Vista, for other people in the office. I can travel away from the new PC to the printer shared on the other Vista computer and installed the printer driv