Clear the field if there's no user input?

Hi folks,
I have a script to place a percentage sign in a form field value that works fine IF you enter a value (see below)
var percentage = this.getField("Principal_1_Ownership").value;
var Principal_1_Ownership = this.getField("Principal_1_Ownership");
if (percentage < 101) { Principal_1_Ownership.value = Principal_1_Ownership.value + "%"; }
else {
Principal_1_Ownership.value = Principal_1_Ownership.value * .10 + "%";
However, it you don't enter a value (maybe you just want to tab through), sometimes it places a
NaN% in the field, and other times it places a simple %.
I don't want either; if the user simple tabs through the field, I want it to appear blank.
Is there a simple method to do this?
Thank you,
Ed

You've got :
if (percentage < 101) ... else...
What you need is something like:
if (percentage =='') ... else if (percentage < 101) ... else...
Make your first 'if' a test for the empty value .

Similar Messages

  • I would like to be able to start typing a URL directly (with no need to clear the field first) after opening a new tab with my homepage...

    I've just installed the newest desktop version of the Firefox browser because my Opera doesn't feel very well these days. I'm trying to become friends with Firefox, and that's why I've changed the new tab settings in order to have my offline homepage loaded every time I open a new tab. There is an inconvenience — when I press Ctrl+T, the cursor appears at the end of the URL. It means that when I start typing, the letters show in the address bar after the URL of my homepage, so what I need is to clear the field first.
    Is there a way to get rid of this? (If it helpes, I'm currently using Windows 7.)
    I would appreciate if I could just press Ctrl+T, type a URL, and press Enter when I want to go to a website different from my homepage. Thank you for your replies!

    Then you can use (Ctrl+L and) Ctrl+A to select all the text in the location bar or Shift+Home/End.

  • How to clear the fields within copy routines in the copy contorl

    HI Gurus,
    I need to clear  the fields VBP-VBELV and VBAP-PSSNV within the copy routines 303 in the copy control between quote item and sales order item. I am not sure how to do that... Can some body please help.
    This is required because we had sales order and quote using the same requirement type which controls the special stock indicator. This leads to the stock getting update in quotation instead of the sales order, because the quotation is initiating document (collecting all cost etc).Now i know requirement should only be passed to production from sales order and not from quotation so i changed the config but there are some existing documents using same requirement type on both quotation and sales order and to correct those i need to clear fields VBP-VBELV and VBAP-PSSNV within the copy routines 303.
    Please help!
    Regards,
    Sam

    Hi ,
    just use this code in ur save button action handler , this will clear the field after entered in to the database and will ready for the next set of data.
    String password=wdContext.currentContextElement().getpwd();
    try{
         InitialContext ctx=new InitialContext();
         DataSource ds=(DataSource)ctx.lookup("jdbc/SAPJ2EDB");
         Connection con=ds.getConnection();
         con.setAutoCommit(false);
         Statement stmt=con.createStatement();
         int retIns = stmt.executeUpdate("insert into TMP_NEWUSERDETAIL(PASSWORD) values("password")");
         con.commit();
         con.setAutoCommit(true);
         wdContext.currentContextElement().setpwd(null);
    or use a seperate button to clear the field.
    wdContext.currentContextElement().set<Attributename>(null);
    Regards
    Vijayakhanna Raman

  • How to configure the schema name dynamically based on user input.

    configure the schema name dynamically based on user input.
    For ex:
    We have two schemas:
    Schema1  - base schema having 15 tables.
    Schema2 -  tables which is specific to modules. Having only 10 tables which is also available in Schema1
    Login to application using Schema 1
    Access a particlular module and select the country. Here country selection is identified.
    Based on the country selection, we need to connect the schema respectively.
    If the user selects France --> It should connect Schema1
    If the user selects Germeny --> It should connect schema2.
    Used: Eclipselink

    You may want to have a different persistence unit for each country, then you just need to switch persistence units, and can put the schema in your orm.xml file.
    You may also want to investigate EclipseLink multi-tenant support,
    http://www.eclipse.org/eclipselink/documentation/2.5/jpa/extensions/a_multitenant.htm
    You can the schema in a persistence unit in code using a SessionCustomizer and the tableQualifier.

  • How to clear the field in APEX...?

    Can any body tell me how to clear or reset the fields in the user interface (APEX 4.0)...? i.e., page items... when i click reset button i want all the fields in my region to be cleared...
    thanks,
    - regards,
    Beginner...

    Create a new process, select "Session State" as process category. Select "Clear Cache for all Items on Pages (PageID,PageID,PageID)" as Process Type.
    Set the conditions to bind it to your button.
    Best Regards,
    Gokhan Atil
    If this question is answered, please mark appropriate posts as correct/helpful and the thread as closed. Thanks

  • How to clear the data in my page after user enter submit button

    hi......
    how to clear the data's in my page after user enter submit button. Actually while pressing first time itself the data is uploaded in database.

    Hi Nazeer,
    Instead of doing it on the same button better create a separate button for this functionality, As per my understanding you want to clear these fields to create new record so that you can enter a new record so for this you just need to insert a new row in VO.
    Still if you want to do it on the same button then you need to put the check that particular record is not dirty if it is not then create new record else create new record.
    One more thing if you will clear on the second click of a button how will you update your record??
    Regards,
    Reetesh Sharma

  • Does anyone know how to clear the fields between uses of a form used in Adobe Reader on an iPhone?

    The iPhone app for Adobe Reader is automatically saving the form each time it is filled out.  (Windows Adobe Reader does not do this.)  This means that you have to manually clear each field before you can use the form again.  Does anyone know a work-around?
    Thanks,

    Hi,
    Please post your question to the Adobe Reader for iOS user forum:
    http://forums.adobe.com/community/adobe_reader_forums/ios
    Regards,
    Brian

  • Clear the field INFOUPDATE and UNLIMITED in Purchasing Order

    Hi experts,
    I have a request to clear the 2 fields Infoupdate and Unlimited in the Purchasing Order.
    I understand that this can be done in the customizing. However I need to have some condition which the customizing cannot be fulfiled.
    For example, the request only require to clear the 2 fields, when creating new item and for a particular plant only.
    Is there a customer exit, bapi, etc that can someone think of?
    Thanks in advance.

    Hi,
    Could you please go through the below link and check the same.
    Adding Reusable Fields - Application Enhancement Tool - SAP Library
    It may help you.
    Regards,

  • How to clear the fields of the screen ?

    Hi,
    I'm having two fields for selection..when i press enter after entering some values,based on that my table control will get filled up..and when i double -click on that row in table control i get all the values of that row in the respective fields in my tabstrip..all these r in same screen 100..and in tabstrip i have 5 tabs with 5 subscreens..containing the fields of table control..now that when i enter a value in the selection screen fields..my table control is getting added with a second row of values as required..but my problem is that the values of the tabstrip should get cleared..this is not happening..i wrote logic like if my tablecontrol is getting appended the values from tabstrip should get cleared..all the fields are getting cleared except the fields of tab which is active..how to do it..

    Hi,
    Try this out.
    declare a variable in Top Include
    data : appended type c.
    if the appending to the internal table is success means sy-subrc = 0
    make appended = 'X'.
    go to the PBO of subscreen of the tab where you want to clear the data
    if appended = 'X'.
    clear appended.( this is must otherwise for every call of the subscreen of this tab the values get cleared)
    here clear the value of the subscreen of the tab strip)
    endif.
    The same can be achieved using the OK_CODE also
    Regards
    Ramchander Rao.K

  • Clearing the field value

    IF l_v_ucomm = c_click.
        IF fp_selfield-fieldname = c_matnr.
          IF fp_selfield-value IS NOT INITIAL.
            SET PARAMETER ID mak  FIELD sd_selfield-value.
    i want to clear the value of sd_selfield but i am not able to clear since it is not an internal table of occurs 0. how can i refresh the body of the field here.
           SET PARAMETER ID ctd FIELD fp_selfield-value.
            CALL TRANSACTION c_ms05 AND SKIP FIRST SCREEN.
          ENDIF.
        ENDIF.
      thanks
      reddy

    Try:
    sd_selfield-value = space.

  • Can set the cursor in next line when user inputted one record?table control

    For Dnypro Table control
    I just know when data check error, we can set the cursor to the error field of current line.
    Now user hope that after they inputted the data of one record, he enter the [ENTER], the cursor can be set to the next new line's first field.
    I tried to use such as
    [SET CURSOR FIELD 'WA_XXXX-XXXXX' LINES 5.].
    But if no any error , the cursor will be automatically setted to the field which setted at Cursor position in Dnypro's attribution
    Can it be realized?
    Thanks.

    try to use same procedure as when you program page down:
      DATA: ITAB_LINES LIKE SY-TABIX,
            FIRST_LINE LIKE SY-TABIX,
            J LIKE SY-TABIX.
      GET CURSOR FIELD CURSOR_FIELD.       "to see what Loop is selected
      DESCRIBE TABLE IRE05 LINES ITAB_LINES.
      RE05-LINES = ITAB_LINES.
        WHEN 'P+'.
    FIRST_LINE = RE05-TOP_LINE + LOOPLINE_IRE05.
    ->      FIRST_LINE = RE05-TOP_LINE + 1.
          J = RE05-LINES - LOOPLINE_IRE05 + 1.
          IF J LE 0.
            J = 1.
          ENDIF.
          IF FIRST_LINE LE J.
            RE05-TOP_LINE = FIRST_LINE.
          ELSE.
            RE05-TOP_LINE = J.
          ENDIF.
    Edited by: Andreas Mann on Feb 28, 2008 11:46 AM

  • How do I change the country for my iTunes account? I had purchased some itunes gift cards and i have about .75USD left in it. I am not able to change the country because i have to clear the account balance. there is any way I could spend that money???

    I would like to change my country from US to Thailand in the iTunes Account. I purchased some iTunes gift card to purchase some apps and since ever i was not able to change my account balance to 0.00USD which is needed in case I want to change my account country. I appreciate if some body can help with this

    1) Buy something 75c or greater and charge the balance to a credit card.
    or
    2) Contact Apple and ask them to keep the 75c
    iTunes Customer Service Contact - http://www.apple.com/support/itunes/contact.html > Get iTunes support via Express Lane > iTunes > iTunes Store

  • How to select every row in a table in case there is no user input ?

    My control block is : DUMMY_BLK . It has field : RPTNO.
    My base Block is : T_UNLDLD_BLK .
    In the property palette, the where clause is : ULD_RPTNO = :DUMMY_BLK.RPTNO
    When the user presses the search button , he gets results according to the report no keyed in . My when-button-pressed trigger contains the following code:
    go_block('T_UNLDLD_BLK');
    execute_query;
    If the RPTNO is null , I should get displayed all records from T_UNLDLD table .
    How can I do that , what do I need to add to the where clause please?
    Thanks.

    I think using same trick will work in this case also.
    Modify your where clause as:
    ULD_SHP_AGCODE LIKE NVL(:DUMMY_BLK.SA_NAME,'%') AND TRUNC(ULD_ETA) BETWEEN nvl(:DUMMY_BLK.ETA,'15-aug-1947') AND nvl(:DUMMY_BLK.ETA_TO,'15-aug-2050').
    Please note, i've taken from date as a value in the past and to date as value in future if they are NULL.
    I am sure, your ULD_ETA will fall between those two default dates.
    Hope it helps.
    Please mark answer as helpful / correct, if it helps you
    Navnit
    Edited by: Navnit Punj on 29-Jun-2009 04:10

  • How to clear the quantity field in the items line from the transaction MIGO

    Dears.
    I need that the field GOITEM-ERFMG from the transaction MIGO comes blank, but, this field have a default value.
    I tried to clear this field in the BADI MB_MIGO_BADI, but, this 'clear' does not work.
    Somebody knows, where I can insert an enhacement in the program SAPLMIGO to clear the field GOITEM-ERFMG, ever that the user add a new line?
    Thanks and Regards.

    Check SAPNotes, there are some that have bug fixes for this issue

  • How to clear the form fields which are not rendered

    I have a creation form. There is a document_type list set up as a partial triger. When user change the document type, only the filed related to that document type will be rendered. This caused a problem when we need to clear the form . The input in the field which is not render won't be cleared when reset button is pressed. Can anybody give a sugestion on how to handle this?
    I tried to use the following function to clear the fields. It does not work since it get the list value before the list value change and clear the fields after the new field rendered.
    public void clear_action(ValueChangeEvent valueChangeEvent) {
    // Add event code here...
    System.out.println("test1");
    String coutcase = null;
    if(EL.get("#{bindings.Proxy.inputValue}") != null){
    coutcase = EL.get("#{bindings.Proxy.inputValue}").toString();
    System.out.println(coutcase);
    AttributeBinding a11= (AttributeBinding)getBindings().getControlBinding("INT_FNAM");
    AttributeBinding a12 = (AttributeBinding)getBindings().getControlBinding("INT_LNAM");
    AttributeBinding a13 = (AttributeBinding)getBindings().getControlBinding("TIT_PROG");
    AttributeBinding a14 = (AttributeBinding)getBindings().getControlBinding("T_OF_INT");
    AttributeBinding a15 = (AttributeBinding)getBindings().getControlBinding("NETWORK");
    AttributeBinding a16 = (AttributeBinding)getBindings().getControlBinding("IN_DATE");
    AttributeBinding a17 = (AttributeBinding)getBindings().getControlBinding("PE_FNAM");
    AttributeBinding a18 = (AttributeBinding)getBindings().getControlBinding("PE_IN_LNAM");
    AttributeBinding a19 = (AttributeBinding)getBindings().getControlBinding("WEBSITE");
    AttributeBinding a20 = (AttributeBinding)getBindings().getControlBinding("URL");
    AttributeBinding a21 = (AttributeBinding)getBindings().getControlBinding("INT_DATA");
    AttributeBinding a22 = (AttributeBinding)getBindings().getControlBinding("D_ACCESS");
    AttributeBinding a23 = (AttributeBinding)getBindings().getControlBinding("CASE_NUM");
    AttributeBinding a24 = (AttributeBinding)getBindings().getControlBinding("COURT");
    AttributeBinding a25 = (AttributeBinding)getBindings().getControlBinding("PLAIN");
    AttributeBinding a26 = (AttributeBinding)getBindings().getControlBinding("DEFEN");
    if(coutcase.equals("Interview")) {
    a11.setInputValue(null);
    a12.setInputValue(null);
    a13.setInputValue(null);
    a14.setInputValue(null);
    a15.setInputValue(null);
    a16.setInputValue(null);
    a17.setInputValue(null);
    a18.setInputValue(null);
    /*a19.setInputValue(null);
    a20.setInputValue(null);
    a21.setInputValue(null);
    a22.setInputValue(null);
    a23.setInputValue(null);
    a24.setInputValue(null);
    a25.setInputValue(null);
    a26.setInputValue(null);*/
    } else if(coutcase.equals("Internet")){
    /*a11.setInputValue(null);
    a12.setInputValue(null);
    a13.setInputValue(null);
    a14.setInputValue(null);
    a15.setInputValue(null);
    a16.setInputValue(null);
    a17.setInputValue(null);
    a18.setInputValue(null);*/
    a19.setInputValue(null);
    a20.setInputValue(null);
    a21.setInputValue(null);
    a22.setInputValue(null);
    /*a23.setInputValue(null);
    a24.setInputValue(null);
    a25.setInputValue(null);
    a26.setInputValue(null);*/
    } else{
    /*a11.setInputValue(null);
    a12.setInputValue(null);
    a13.setInputValue(null);
    a14.setInputValue(null);
    a15.setInputValue(null);
    a16.setInputValue(null);
    a17.setInputValue(null);
    a18.setInputValue(null);
    a19.setInputValue(null);
    a20.setInputValue(null);
    a21.setInputValue(null);
    a22.setInputValue(null);*/
    a23.setInputValue(null);
    a24.setInputValue(null);
    a25.setInputValue(null);
    a26.setInputValue(null);
    }else{
    System.out.println("coutcase is null");
    }

    Hi,
    The easiest way to modify the screens in the Std transactions using ITS is to modify the ITS templates corresponding to that transaction.
    E.g In you case,there will be a ITS service corresponding to the ESS transaction.This ITS service will have  number of HTML templates which will actually correspond to the diffrent screens in the Trascn.What you need to do is find out the HTML template in the ITS service which corresponds to the screen(which you want to modify) in the STd transacn.To do this ,the easiest way is to right click on that Web page and say VIEW SOURCE.It will show you a HTML code with the ITS service name and the template which is being used for that particular screen.
    So after you find out the correct HTML template to be modified,you can simply hide the fields by putting the HTML code lines in between the symbols
      <!   and  -->
    BR,
    Disha.
    <b>Pls reward points for useful answers.</b>

Maybe you are looking for