Using IF's with a blank text field

Is there a way of making this IF carry out its function if txtExchange is blank? Sorry if this seems a really simple question but am still trying to get my head around java. Thanks
if(Integer.parseInt(txtExchange.getText()) <= 0.00)
txtOutput.setText(Double.toString( x * y ));
else
txtOutput.setText(Double.toString( x * z ));

Basically what am trying to is that when the text field txtExchange is blank then another default value is used (y).
if(optDollarToEuro == optDollarToEuro) {
double x;
double y;
double z;
x = Integer.parseInt(txtInput.getText());
y = 0.748279;
z = Integer.parseInt(txtExchange.getText());
if((txtExchange.getText()) <=0)
txtOutput.setText(Double.toString( x * y ));
else
txtOutput.setText('?' + Double.toString( x * z ));
}

Similar Messages

  • Auto populate blank text fields with n.a from a button or on print out.

    This seems straight forward but I cannot find an existing questions on this topic.
    I would like to add a form function that will fill any blank text fields with n.a. I do not want to use the default field value as I think it will cause confusion and cannot be applied for text fields formatted for dates. Is it possible to run a script that can do this? It would be OK if the action was triggered from a button or print activity after the rest of the form has been completed.
    Any thoughts would be appreciated.
    Thanks

    The question is whether your form is used only for filling out on screen (and not as a level 0 form, being printed out and filled out manually).
    If so, why not make the default value of the concerned fields to be "n/a" (or whatever you want to name them). That would relieve you from any validating before printing.
    Otherwise, you could maintain a list of field names which should get the n/a value if empty. This list would be an array.
    Your code in the willPrint event (if you want to have it reliably) would then look like this:
    for (var i = 0 ; i < nafieldarray.length ; i++) {
    if (this.getField(nafieldarray[i]).value == this.getField(nafieldarray[i]).defaultValue) {
    this.getField(nafieldarray[i].value = "n/a") ;
    HTH.
    Max Wyss.

  • Text field properties-Using the 'required' option in the text field properties.

    Using the required' option in the text field properties.
    The 'help' manual describes the 'required' function as this: Required Forces the user to fill in the selected form field. If the user attempts to submit the form while a required field is blank, an error message appears and the empty required form field is highlighted.
    My users ARE not submitting the form, they open the pdf, fill it out and print it. HOW can I, make a field "required', I don't want them to skip/leave blank specific fields. However, if I choose the box 'required' in the text field properties, and I begin filling out the form, I can just tab past that field that I've choose as 'required', and I do not get
    prompt/error message or anything, it allows me to save, or print.
    I WANT SOME TYPE OF message (similar to enter a company order form
    off the web, where you can't continue without filling out 'required' fields).
    Is there a step/option I am not doing?

    Then you are going to have to write some JavaScirpt to be executed by the "Will Print" document action to check all the requried fields, either by name or by the 'required' property and handle the issue of the imcomplete fields. You will not be able to stop the print, but you could display and error field so the user knows the form is incomplete and the printed form also conatains this information.

  • Using radio buttons to populate a text field

    Hi
    This is my first time creating Adobe Forms and my first time using JavaScript as well. One of the questions on my form asks about Ethnicity and I have about 15 choices for which I created radio buttons. I want the user's choice to populate a textfield, but am not sure how to write the code that will do this. Any help would be greatly appreciated. Thanks

    If you set the export value (aka Button Value, Radio Button Choice) of each radio button to the text you want to show up in the text box, the custom calculate script for the text box, which you should set to read-only, can be simply:
    (function () {
        // Get the value of the radio button group, as a string
        var s = getField("Ethnicity").valueAsString;
        // Set this field's value to the text associated with the selected radio button
        event.value = s === "Off" ? "" : s;
    If none of the radio buttons is selected, the text field will be blank. Change "Ethnicity" above to the actial name of the radio button group.

  • Problem with characters in text field

    hi all
    i am missing a few characters, once i load text into a dynamic text field. chars are not missing per say; they are being replaced with empty squares.
    characters like the euro sign and accentuated german a letter.
    whats is weird is that other accentuated german letters do appear. so only a few selected are missing.
    How ive set up the fla:
    1) i've added 4 text fields to the stage in the font im using, Arial, one for each font style: normal, italic, bold and bold italic, and in all 4 fields ive embedded all latin characters (to include the german accentuaded characters and im guessing it's in the punctuation group that holds the euro sign, so that one is also embedded), besides lowercase, uppercase, numerical, and all the default groupd to include basic text.
    2) i've got a dynamic text field, created with createTextField, and setup the following ActionScript (2):
    this.createTextField("T_text",1,0,10,Stage.width-60,50);
    var myFmt = new TextFormat();
    myFmt.size = 12;
    myFmt.leading = 3;
    myFmt.font = "Arial";
    T_text.html = true;
    T_text.autoSize = "left";
    T_text.multiline = true;
    T_text.wordWrap = true;
    T_text.selectable = false;
    T_text.embedFonts = false;
    T_text.textColor = "0x666666";
    T_text.htmlText = _global.gallery_1_image_text_1; // this holds the text im displayed, called in from a database.
    T_text.setNewTextFormat(myFmt);
    now, im calling text from a database.
    when calling the text from the browser  url bar, there's no chars missing.
    its just when i make this call from flash and load the text into the dynamic text field, that characters go missing.
    below is a link to a print screen of the faulty text that is displayed in flash's dynamic text field.
    http://img210.imageshack.us/img210/340/utf8.png
    any ideas? i mean, it seems that the arial font is missing a few accentuated characters! because the code i have setup loads other accentuated characters.
    anyone has seen this issue before and know how to solve it?
    regards

    no.
    you assigned your embedFonts property to be false.
    look, you can test if you've embedded fonts correctly by using:
    T_text._rotation=3;
    if you see no text, you're not embedding fonts correctly.
    so, use:
    T_text.embedFonts=true;
    and then test.  if you see no text, use:
    click on the upper right of your library panel > new Font > select Arial and tick the symbols you need to embed > tick export for actionscript and assign a linkage id (eg, ArialID). click ok.  then use:
    this.createTextField("T_text",1,0,10,Stage.width-60,50);
    var myFmt = new TextFormat();
    myFmt.size = 12;
    myFmt.leading = 3;
    myFmt.font = "ArialID";
    T_text.html = true;
    T_text.autoSize = "left";
    T_text.multiline = true;
    T_text.wordWrap = true;
    T_text.selectable = false;
    T_text.embedFonts = true;
    T_text.textColor = 0x666666;  // no quotes here.  this is a number
    T_text.htmlText = _global.gallery_1_image_text_1; // this holds the text im displayed, called in from a database.
    T_text.setTextFormat(myFmt);  // to format the above text, use setTextFormat().  if you want to format text added after this line, use setNewTextFormat()

  • How do I get multiple lines to print for a blank text field so that it can be filled in by hand?

    I have to design forms that are fillable electronically and by hand.  The problem that I am running in to is supplying multiple lines that will print for people that are hand filling the form.  I have tried to add an image of lines behind the text field, but these would get in the way when the form was filled in electronically.
    I am using LiveCycle Designer ES2 v. 9.0 on a Windows machine.
    Thanks.

    Ok.
    Take a textfield
    Go to Object | Allow multiple lines
    Go to Layout | Height | activate "Expand to fit"
    Go to the initialize-Event or readyform (You have to change the _ for your textfield)     this.rawValue = "___________\n___________\n___________";
    Go to the enter-Event   this.rawValue = null;
    Go to the exit-Event  
              if(this.rawValue == null)
                    this.rawValue = "___________\n___________\n___________";
              }else{}
    With this solution you can simulate the same as pattern see above.
    I hope this is helpfull for you,
    Mandy

  • How to use the separate symbol in the text field in the adobe form.

    Hi,experts,
    I don’t know how to use the separate symbol to make a paragraph separate into several lines correctly in the text field in the adobe form.
    Action:
    1. config the ADS successfully.
    2. create the adobe form with a mult-line textfield(binding the 'remark' context in the interface of the form) using sfp.
    3. create a WDA for invoke the form and transfer the 'remark' context data.
    I use the following codes to display the paragraph in the PDF document:
    CONCATENATE
    '1&#12289;aaaaaaaaaaa&#65307;'
    '2&#12289;bbbbbbbbb '
    '3&#12289;ccccccccccc'
    '4&#12289;ddddddddd'
    INTO remark .
    lo_nd_z_hr_php_payslip->set_attribute(
    EXPORTING
    name = `REMARK`
    value = remark ).
    But I found all the content aren't paragraph separate correctly in the text field in the adobe form when I run the WDA.
    Could you please give me some hints to make the paragraph separate correctly in PDF document? Thanks a lot in advance!
    My email is : [email protected]
    Best regards,
    Tao
    Edited by: wang tao on Apr 8, 2008 1:58 AM

    Hi,
    If it is just a one word value then you could use this in the exist event;
    this.rawValue    
    = util.printx(">?<*",this.rawValue);
    This changes the first character (represented by the ?) to uppercase (represented by the >) and all trailing characters (represented by the *) to lowercase (represented by the <).
    If you wanted something more general ... if they could also enter a middle name then you could call a function like;
    function        toTitleCase(textValue)
      return  textValue.toLowerCase().replace(/\b[a-z]/g, function replacer(match) { return match.toUpperCase(); });
    This uses a regex to change all lowercase letters following a word boundary to uppercase.
    Bruce

  • If condtion  not working  in blank text field

    I want that when the text field is blank it should go to the else if portion of the code below:
    JTextField tf1=new JTextField(15);
    if (tf1.getText() != null)
    JOptionPane.showMessageDialog(tf1, "insert value in the range of a-z,A-Z,0-9");
    }                          else if (tf1.getText() == null)
                             System.out.println("fdsafasdfasdfsdf");
    System.out.println("1234");
                                                      JOptionPane.showMessageDialog(tf1,"Enter SmartTextID");
    but control never goes to ==null,even i have initilaized textField with a text then also when i chk with tf1.getText() == "assigned text", its not working.
    plz send me the correct code for this
    thanx..

    if ( textField.getText().trim().equals("") );

  • IExpenses-12.1.3 Facing Issue with 2 custom text fields on the standard OAF

    Dear All,
    We are facing problem where custom text fields on standard OAF page does not retain their values when we traverse back-forth on the OAF page.
    Here is the exact issue details
    1) We added 2 text fields(Attribute5 and Attribute6) through personalization on Mileage Line Details Screen(standard OAF page) of iExpenses 12.1.3.
    2) And business requirement is whenever user enters values into these fields, difference of these values is populated in third field which is standard field on that page.
    Issue
    When user enters values into above 2 fields, difference is calculated correctly however once he clicks on return page and comes back again on the detail page
    then all the standard fields retain their values but 2 custom fields have blank value.
    Is there any issue with personalization? or any other issue? Please suggest.
    Thanks,
    Mahesh

    Thanks Pratap for checking
    There is button named as "Calculate Amount" on the line details page so it is happening in below 2 scenario
    1) When User enters values in 2 fields and clicks on Calculate Amount Button then values get disappeared from custom fields
    2) When user clicks on return button, go to main page and clicks on detail button ( to come back on same line) then all the standard fields have valuece and custom one's disappeared.
    Thanks,
    Mahesh

  • Having issues with populating a Text Field with data from 2 other fields

    I have 3 fields Tools_1a_pri, Tools_1a_pri_other, Tools_1a_pri_txt.
    Tools_1a_pri is a drop down combo with a predefined list. One of the options is "Other".  When "Other" is selected, the text field Tools_1a_pri_other becomes visible for users to enter the name of the other tool.
    The Tools_1a_pri_txt is a text field with a calculation that shows either text stating that no tool has been selected or the Tools_1a_pri & or Tools_1a_pri_other.
    When I select one of the predefined tools, everything works.  When I select other, it appears that nothing has changed.  It requires that I click on another field before it populates.  This is confusing to the user.
    Tools_1a_pri   Validate code
    this.getField("Tools_1a_pri_Other").display = event.value=="Other" ? display.visible : display.hidden;
    Tools_1a_pri_txt  Calculation code
    //if nothing is selected, do the following
    if (getField("Tools_1a_pri").value.length < 2) {
    event.target.textColor = color.red
    event.value = "No primary tool identified";
    }else if (getField("Tools_1a_pri").value != "Other") {
    //otherwise do this if other is selected
    event.target.textColor = color.black
    event.value = getField("Tools_1a_pri").value;
    }else if (getField("Tools_1a_pri").value = "Other") {
    //otherwise do this if other is not selected
    event.target.textColor = color.black
    event.value = getField("Tools_1a_pri").value + " - " + getField("Tools_1a_pri_Other").value;

    You made the classic mistake of using the assignment operator in an if-statement instead of the comparison operator. Change this line:
    } else if (getField("Tools_1a_pri").value = "Other") {
    To this:
    } else if (getField("Tools_1a_pri").value == "Other") {

  • Dynamic Forms with Subforms and Text Fields

    I've been reading all of the messages relating to subforms and dynamic forms and have used many of the suggestions, but haven't found anything that addresses the problem I am having. I'm using Designer 7.0. I've saved my form as a dynamic form, I've set my text fields for multiple lines and expand to fit. My problem is that as soon as I set the parent subform to Flow Content, everything moves to the left margin. I've tried grouping items together within a subform in hopes that the items will maintain their position on the page, but everything always moves to the left margin. I'm creating a legal form that needs to have text and a text field centered at the top of the page. Below that to the left is a text field that needs to be able to expand with two text fields to the right of it. Below that are additional text fields that need to expand as needed.
    Am "stacking" my subforms incorrectly and setting the wrong subform to Flow Content? Or, can you now lock a field to a specific position? Any help would be greatly appreciated.

    Unfortunately, I hadn't understood that you needed the fields to expand in height and everything below them to move down the page. In that case, you'll need to use flowed subforms.
    Having all objects move to the left side of the page is expected when setting a subform to flowed. That's because the flow is top-down, left-right.
    One thing you could try is making the text field that needs to be centered exactly as wide as the flowed subform and then setting its left- and right-hand margins to an equal number. This would ensure an equal amount of space on the left- and right-hand sides and because the field would be as wide as its flowed container (subform), entering multiple lines of text would result in everything below moving down.
    I've attached a sample form where the page subform has been set to flowed, the text field at the top is a multi-line/height-expandable text field with its width set to the page width and its left- and right-hand margins both set to 2in and the button and check box objects are pushed below the text field.
    When text is entered into the text field, it expands in height and causes the button and check box to move down.
    To achieve other horizontal and vertical positioning/offsets, you could play with the margins of all the fields that need this.
    Stefan
    Adobe Systems

  • Custom Infotype with multiple long text fields

    Hi,
    We have a need to create a custom Infotype (in PA or PD) that will contain more than one long-text area.
    I've searched this forum and found that there are generally two approaches :
    1. use the HR clusters for long-text and setting the ITXEX field in PA
    2. using SAP standard text area (SO10) and functions such as READ_TEXT, SAVE_TEXT, etc.
    The problem with (1) is that it can only store one long-text.  We need to have many.  Please correct me if we can hold more than one long text in the cluster...?
    With regard to (2), I'm just not sure that this is the correct place to store the long text...?
    If I was to adopt option (2), could I just use the key of PA9nnn (ie: PAKEY) as the key/TDNAME for STXH?
    Are there any other methods to store long text?
    As well, is it possible to create a custom Infotype in PD?  Can we use PM01 to create PD infotypes?
    Thanks,
    Raj

    Raj
    Sorry I'm not much help on the two questions you have raised...you have probably already got answers by now anyway..however FYI check out link below for enhancing PD infotypes (use transaction PPCI).
    enhance infotypes

  • Form with only 1 text field + ENTER: Error 404

    I have several JSP pages with forms to enter/edit data. As long as I use the mouse to click the submit buttons, I get no errors. If the form has more than 1 text field to enter, i can also edit one of these text fields and press the ENTER/RETURN key which has the same effect as the submit button clicked with the mouse. But if a form just has 1 text field, I get the following error when I press the ENTER/RETURN key (instead of clikcing the submit button with the mouse):
    Error 404--Not Found
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.4.5 404 Not Found
    The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
    This is the same case on all JSP pages that only has 1 text field: they work when using the mouse by pressing the submit button but fail when using the ENTER/RETURN key.
    Is this a known bug? Is there a workaround for this?

    I believe that text inputs can have their own action
    attribute, so providing the same value there as in
    the form may help (though by default it should defer
    to the form's action).
    So try something like:
    <form action="x.jsp">
    <input type="text" name="..." action="x.jsp"/>
    </form>
    That doesn't help. The addresss bar is also always the same as the jsp pages are displayed in a html frame.

  • CreateTextField and _height: Problem with Placement of Text Fields

    I'm using createTextField to create several text fields
    dynamically. I'm also using an external XML file and a style sheet
    to populate the text fields.
    My problem is that I'm trying to position the various text
    fields on the page so that they are spaced evenly on the page
    (regardless of how much content they might contain). I'm trying to
    use _height of the prior text fields to place subsequent text
    fields, but I'm getting very inconsistent results. When I trace the
    value of _height, I get differing results, even if I don't actually
    change any of the parameters. So, the question is...is there a way
    for Flash to get the height of a dynamically created text field
    that's populated via an exteral XML file and using CSS? I know
    that's asking a lot, but I'm trying to avoid using scroll bars if
    at all possible.
    Thanks for any pointers.
    Bill

    i assume you're using multiline textifields with a fixed
    width and autoSize="left".
    flash will report the correct _height of your textfields IF
    you access the _height property after your htmlText has been
    assigned to your textfield. ie, you're probably seeing inconsistant
    results because you're not waiting until all data needed to
    populate your textfield has loaded.

  • Please Help me with FormCalc Customized Text Field

    A while ago someone online did a great thing for me- they helped me create a Text field that would type "This document was printed on _________" and include whatever day the pdf form was printed off our employer's intranet site.
    I had a shortcut to it in my favorites and would click on it and plave it on every new document I needed it to be on.
    Since the computer I was using suddenly crashed, I cannot find the details of how to set this up again. I have a pdf form that includes the box, but when I open it in LiveCycle, it is just blank.
    This is what I saved:
    <field h="8.4935mm" name="PrintedOn" w="141.0398mm" x="-0.0001mm" y="0mm" xmlns="http://www.xfa.org/schema/xfa-template/2.5/">
       <ui>
          <textEdit>
             <border hand="right" presence="hidden">
                <?templateDesigner StyleID aped0?></border>
             <margin/>
          </textEdit>
       </ui>
       <font size="18pt" typeface="Tahoma" weight="bold">
          <fill>
             <color value="221,221,221"/>
          </fill>
       </font>
       <para hAlign="center" vAlign="middle"/>
       <bind match="none"/>
       <event activity="prePrint" ref="$host">
          <script>$.rawValue = concat("This document was printed on: ", num2date(date(), DateFmt(1)));</script>
       </event>
    </field>
    I do not remember what to do to get this working.
    I use this "Printed On" textbox ALL the time, and I need to figure out what to do to get it working again quickly.
    If there is anyone who could help me, I could also send you a sample of a form that includes it- then you can see exactly what I mean.
    If someone could remind me how to program this kind of thing in once again and save it in LiveCycle, then explain how I can put it on another computer as well, I would really, REALLY appreciate it.
    ~Chris
    PS- this one as I had it set up only prints the Printed on message/date on the first page. If it could somehow print on EVERY page of the PDF without me having to click and add it to every single page individually, that would be even better... but first things first!

    Great, got it working!
    Now just wondering, is there any way for this to appear on every page, or would I have to place this box on every page?
    I have ~20 page documents and I have had requests to have this "printed on" show up on every page, but doing so seems like ti would be very time consuming.

Maybe you are looking for