How to keep a calculation field blank until the user enters a number?

I am building a sales sheet for a school that sells scrip as a fund-raiser. I have the document set so that when the user enters the number of scrip certificates he wants (say, two $25 gift certificates at Lowe's), the program will automatically calculate that this user owes $50 for that scrip category. However, there are more than 100 companies that one can choose from, and if the user doesn't enter a number, the calculated field shows $0. Is there a way that each field can stay blank until the user enters a number bigger than zero? By the way, I'm using this calculation to determine the value (borrowed from a user on this forum): event.value = 50 * this.getField("Lowes").value
Thanks!

There are two approaches. You can either add the following Validate script:
// Custom Validate script for calculated field
if (+event.value !== 0) event.value = "";
Or you can change your custom Calculate script and set the Format type of the field to "None":
// Custom Calculate script
(function () {
    var v = +getField("Lowes").value;
    event.value = (v !== 0) ? util.printf("$%.2f", v) : "";

Similar Messages

  • How to mask a particular field depending on the user for a protected pdf?

    Hi,
    I have a requirement of showing a particular fiels data to only one user and to hide that critical data to others. For example, suppose I have two users viz, Primary user and Secondary user. I have a field named UID in my protected pdf form which has some critical data. I want only my Primary user enter and view the information entered in the UID field. When the Secondary user opens the document using his credentials, he should not be able to view the data in the UID field. It should be displayed in astrix as in a password field. Can anyone help me how to acheive this for a protected document?
    Thanks and Regards,
    Maria Johni

    It is possible. You should be having a field in your XSD schema for the username. Bind the username to a hidden field in your form.
    In the designer, in form initialize event,
    write the code: if hiddenfield.rawValue == "person A"
                                 subform1.presence = "hidden";
                           if hiddenfield.rawValue == "person B"
                                 subform2.presence = "hidden";
                                 subform1.presence = "visible"   }
    In your process, when your moving from one step to other step, update the uname accordingly and the form will respond according to the username.
    Regards,
    Chaitany

  • How do I make form or table where certain numbers update according to a formula when the user enters one number?

    Hi, I am an amature website designer and have made a website
    using dreamweaver. I am very lost when it comes to doing tougher
    things in dreamweaver. I want to create a small form or a table
    where there will be 7 or so numbers that are generated based on
    simple formulas for each one once you enter one number. Can someone
    please help me with this task whether it is in dreamweaver or even
    making it out of flash or anyway that this would be the easiest to
    make possible. Thanks

    Here's a very simple form you could use to perform a
    calculation, it this case, squares the input value and writes it
    back to another input field... Hopefully you can use this as a
    pattern to apply your own algorithm. You'll need to do validation
    to assure the entered fields are appropriate for the calculation
    (required fields are entered).
    Hope this gets you started.
    ================================================
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta content="text/html; charset=utf-8"
    http-equiv="Content-Type" />
    <script type="text/javascript">
    function squareit() {
    var num = document.getElementById('myinput');
    var res = document.getElementById('myresults');
    res.value = Math.pow(parseFloat(num.value), 2);
    </script>
    </head>
    <body>
    <form id="myform">
    <label for="myinput">Number: </label><input
    id="myinput"><br/>
    <label for="myresults">Result: </label><input
    id="myresults"><br/>
    <input type="button" value="Calculate"
    onclick="squareit()"/>
    </form>
    </body>
    </html>

  • How to insert a dialog box which prompt the user enter the general information in the SDI application?

    Im using the SDI application to build a system and now i would like to insert a dialog box which allow the user to enter the general information about themselves and then it will be saved into a text file. How to insert the dialog box and show the dialog box at the beginning of the program.

    Hi Lee,
    The easyest way to achieve this is to declare an object of your dialog box derived class (e.g. CUserInfo, public CDialog) into the InitInstance method of the main application class.
    Depending on the behavior you want you can place the code before dispatching the commands from command line (in which case the main frame of the SDI application will not be shown), or after, in which case the UserInfo dialog box will be shown over the main application window as modal.
    The code snipped bellow can be more helpfull:
    BOOL CSDIApp::InitInstance()
    AfxEnableControlContainer();
    // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);
    //prompt user for data
    CUserInfo dlg;
    if (dlg.DoModal() == IDOK)
    //do something here with the data
    else
    return FALSE;//i.e. quit the application if the user presses the 'Cancel' button
    // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
    return FALSE;
    // The one and only window has been initialized, so show and update it.
    m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow();
    return TRUE;
    Hope this helps,
    Silvius
    Silvius Iancu

  • How to create a calculated field

    Hi. I'd like to know how to create a calculated field for a master- detail form. For example: having two db fields price and quantity, i created a the total item (price * quantity) as pl/sql function like this:
    begin
    :p13_item_total := :p13_price * :p13_quantity;
    end;
    However, the item is not calculated. It is not and instant calculation. I mean if i modify either price or quantity, how to recalculate item total immediately

    You must submit the page to do it with PL/SQL. If you do not want to submit the page, you must do it with JavaScript.
    Thanks,
    Tyler

  • How to preven JButton of generated actions when the user keep pressing down

    How to preven JButton of generated actions when the user keep pressing down the key or the short cut
    The code below to show the issue when the user keep pressing Alt+ O
    We want to prevent the JButton from generating multi actions just one action only
    A sample of code shows the behaviour which has to be prevented. Continue pressing "Alt +O" and you will see the standard ouptput will print time stamps
    Please notice, I am NOT interested in Mouse press which has a solution by adding a threshold ( setMultiClickThreshhold(long threshhold) on the JButton  as an attribute.
    public class TestPanel extends JPanel
       private JButton btn;
       public TestPanel()
          btn = new JButton("Open");
          this.add(btn);
          registerCommand(new MyAction(), InputEvent.ALT_MASK,
                KeyEvent.VK_O, btn, btn.getText(), 0);
       public static void registerCommand(AbstractAction action,
             int mask,
             int shortCommand,
             JComponent component,
             String actionName,
             int mnemonicIndex)
          InputMap inputMap = component.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
          KeyStroke knappKombination = KeyStroke.getKeyStroke(shortCommand, mask);
          if ((component instanceof AbstractButton)
                && mnemonicIndex >= 0
                && mnemonicIndex < actionName.length()
                && (shortCommand >= KeyEvent.VK_A && shortCommand <= KeyEvent.VK_Z))
             ((AbstractButton) component).setDisplayedMnemonicIndex(mnemonicIndex);
          if (inputMap != null)
             ActionMap actionMap = component.getActionMap();
             inputMap.put(knappKombination, actionName);
             if (actionMap != null)
                actionMap.put(actionName, action);
       public static class MyAction extends AbstractAction
          private static final long serialVersionUID = 1L;
          @Override
          public void actionPerformed(ActionEvent e)
             System.out.println(System.currentTimeMillis());
       public static void main(String... args)
          SwingUtilities.invokeLater(new Runnable()
             public void run()
                JFrame frame = new JFrame("Testing");
                JPanel panel = new TestPanel();
                frame.getContentPane().add(panel);
                frame.setPreferredSize(new Dimension(500, 500));
                frame.setMinimumSize(new Dimension(500, 500));
                frame.pack();
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setVisible(true);
    }Edited by: user12130673 on 2013-feb-13 03:01

    Use KeyStroke getKeyStroke(int keyCode, int modifiers, boolean onKeyRelease) with onKeyRelease=true instead?

  • How do I create a form field ONLY template in Acrobat 9 Pro that will let the user enter and print only the form field data on a pre-printed form?

    This template will be used to type in information that will then be printed on an agency's official, barcoded form loaded in a printer (instead of blank paper.)  Only the user-entered info should print on the pre-printed form.  Users will use Adobe Reader to complete their templates; they do not have Acrobat.  Thank you!

    Use the template as non-printable background and add the form fields.

  • How can i transfer a field value in the main report to its sub-report?

    <p><font face="Arial" size="2">How can i transfer a field value in the main report to its sub-report?</font></p><p><font face="Arial" size="2">Please eloberate with example if possible!</font></p><p><font face="Arial" size="2">Thanks...</font></p><p> </p>

    <p>You can do a couple of things - one would be to pass the information using the data linking expert.  Right click on the subreport, choose &#39;Change Subreport Links&#39; and select the field(s) you are wanting to pass to the subreport.  CRW will build parameters and a record selection formula for you in the subreport, and if that&#39;s what you want, then great.  But you can also remove the selection formula from the subreport and work with the parameter fields in the subreport however you would like.</p><p>Alternatively, you can look to passing Shared variables back and forth from the main and subreport.  this link talks about the method to do this: http://diamond.businessobjects.com/node/251</p><p> </p>

  • Can I cause checking a box to add 1 to a calculated form field?  I have a field that sums the numbers entered in several previous fields and need to be able to add "1" if a checkbox is selected as well.

    Can I cause checking a box to add 1 to a calculated form field?  I have a field that sums the numbers entered in several previous fields and need to be able to add "1" if a checkbox is selected as well.

    I think it has something to do with the way the value of the check box is exported, but I'm not sure.  With nothing being exported to Data5, Data6 displays the sum of Data1-4 rounded down to the nearest whole number and updates automatically as Data1-4 are updated.
    Right now, assuming Data1-4 are 0, where data 5 is the output of the second example and any box is checked,  "1" is displayed in data5 but nothing is added to data 6. Selecting any other check box or deselecting that check box will cause data6 to add 1 even if data5 displays "0".  By way of example:
    Selecting Check box 16 results in Data5 displays 1 and Data6 displays zero.
    Then, if any or all of Checkbox17-20 are selected, Data5 displays 1 and Data6 displays 1.
    Then, if any or all of Checkbox17-20 are deselected, Data5 Displays 1 and Data6 displays1.
    Then, if Checkbox16 is deselected, Data5 displays 0 and Data6 displays 1.

  • How to enable/disable the input fields based on the data entered/user action in the web dynpro abap?

    How to enable/disable the input fields based on the data entered in the web dynpro application abap?  If the user enters data in one input field then only the next input field should be enabled else it should be in disabled state. Please guide.

    Hi,
    Try this code.
    First create a attribute with the name readonly of type wdy_boolean and bind it read_only property of input field of which is you want to enable or disable.
    Next go to Init method.
    Set the readonly value as 'X'.
    DATA lo_el_context TYPE REF TO if_wd_context_element.
         DATA ls_context TYPE wd_this->element_context.
         DATA lv_visible TYPE wd_this->element_context-visible.
    *   get element via lead selection
         lo_el_context = wd_context->get_element( ).
    *   @TODO handle not set lead selection
         IF lo_el_context IS INITIAL.
         ENDIF.
    *   @TODO fill attribute
    *   lv_visible = 1.
    *   set single attribute
         lo_el_context->set_attribute(
           name =  `READONLY`
           value = 'X').
    After that Go to the Action  ENTER.
    First read the input field ( first input field, which is value entered field) , next give a condition
    if input value is not initial  then set the readonly value is '  '.
    DATA lo_nd_input TYPE REF TO if_wd_context_node.
         DATA lo_el_input TYPE REF TO if_wd_context_element.
         DATA ls_input TYPE wd_this->element_input.
         DATA lv_vbeln TYPE wd_this->element_input-vbeln.
    *   navigate from <CONTEXT> to <INPUT> via lead selection
         lo_nd_input = wd_context->get_child_node( name = wd_this->wdctx_input ).
    *   @TODO handle non existant child
    *   IF lo_nd_input IS INITIAL.
    *   ENDIF.
    *   get element via lead selection
         lo_el_input = lo_nd_input->get_element( ).
    *   @TODO handle not set lead selection
         IF lo_el_input IS INITIAL.
         ENDIF.
    *   get single attribute
         lo_el_input->get_attribute(
           EXPORTING
             name =  `VBELN`
           IMPORTING
             value = lv_vbeln ).
    if lv_vbeln IS not INITIAL.
        DATA lo_el_context TYPE REF TO if_wd_context_element.
        DATA ls_context TYPE wd_this->element_context.
        DATA lv_visible TYPE wd_this->element_context-visible.
    *  get element via lead selection
        lo_el_context = wd_context->get_element( ).
    *  @TODO handle not set lead selection
        IF lo_el_context IS INITIAL.
        ENDIF.
    *  @TODO fill attribute
    *  lv_visible = 1.
    *  set single attribute
        lo_el_context->set_attribute(
          name =  `READONLY`
          value = ' ' ).

  • How to add a field to the selection screen and when the user enters ...

    hi all,
    can any one plesase send the code of how to add a field to seletiion screen and when the user enters in the field , it should be store in the database table , the table is MKPF and the field is BKTXT.  Thanks.

    Hi Kripa,
       If u r using PNP ldb then the screen u will get is the screen for that ldb and if u want to add some more fields then u define using selection-screen..as follows
    SELECTION-SCREEN BEGIN OF BLOCK mysel WITH FRAME TITLE text-111.
    PARAMETERS: n_in_en  RADIOBUTTON GROUP g1,
                q_ev  RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF BLOCK mysel.
    SELECTION-SCREEN BEGIN OF BLOCK mysel1 WITH FRAME TITLE text-222.
    PARAMETERS: r_date TYPE sy-datum DEFAULT sy-datum.
    SELECTION-SCREEN END OF BLOCK mysel1.
    SELECTION-SCREEN BEGIN OF BLOCK mysel2 WITH FRAME TITLE text-333.
    PARAMETERS:f_ver(3) TYPE c DEFAULT 1,
               c_no(10) TYPE c DEFAULT '9D0161',
               u_id(15) TYPE c,
               password(15) TYPE c,
               r_email(30) TYPE c DEFAULT PARAMETERS: s_not TYPE c AS CHECKBOX.
    PARAMETERS:t_run TYPE c  AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK mysel2.
    SELECTION-SCREEN BEGIN OF BLOCK mysel3 WITH FRAME TITLE text-444.
    SELECTION-SCREEN BEGIN OF BLOCK mysel4 WITH FRAME TITLE text-555.
    PARAMETERS: p_ser  RADIOBUTTON GROUP g2,
    a_ser  RADIOBUTTON GROUP g2.
    SELECTION-SCREEN END OF BLOCK mysel4.
    SELECTION-SCREEN BEGIN OF BLOCK mysel5 WITH FRAME TITLE text-666.
    PARAMETERS:p_path TYPE string.
    SELECTION-SCREEN END OF BLOCK mysel5.
    SELECTION-SCREEN END OF BLOCK mysel3.
    u will get this additional screen after the screen of ldb.
    I hope this will help u..
    Thanks & Regards
    Ashu Singh.

  • How to execute a string formula and assign the result to a number field

    How to execute a string formula and assign the result to a number field
    Hi,
    we have a function that returns a string like this:
    '(45+22)*78/23'
    After we should calculate this string and assign the value to a numeric block field
    Example:
    k number(16,3);
    k:=fun1('(45+22)*78/23'); where fun1 execute and translate to number the string.
    Does exist a function like fun1 ??
    How can we do ?
    Regards

    Hello,
    this is the code that does the job:
    SQL> set serveroutput on
    SQL> DECLARE
    2 ch VARCHAR2(20) :='22+10' ;
    3 i NUMBER ;
    4 BEGIN
    5 EXECUTE IMMEDIATE 'select ' || ch || ' from dual' INTO i;
    6 dbms_output.put_line ('i = ' || TO_CHAR(i));
    7 END ;
    8 /
    i = 32
    Procédure PL/SQL terminée avec succès.
    SQL>
    just you have to do is to create a small stored function that take the string to calculate and return the number result
    Francois

  • How do i lock all fields without using the signature function with adobe lifecycle designer 9

    How do i lock all fields without using the signature function with adobe lifecycle designer 9 ...
    I want it to have the same affect as when a signature is used but not use that function. I want a button that says lock all fields. And then you can click it again to unlock all fields...
    Thanks

    Here you go!
    LOCK the form once its SAVEd?

  • How can I pause a slide until the user clicks a button?

    I wish to pause a slide until the user clicks a button (which I've created out of a Smartshape). The thing is that I haven't added a click box object over the smartshape but have only set the smartshape properties to "Use as Button". If I were to add a clickbox object, I would get a "Pause project until user clicks" in the options section of the properties. However in using a smartshape as a button, I cannot find this option. I am using Captivate 6. Seems strange as I would have expected to see the same checkbox option even if I were to use a smartshape as a button but I dont. Can't someone help me and let me know if I'm missing something.
    Of course I could use a clickbox over my smartshape to achieve what I want, but I want to avoid thsi for two reason:
    I want to avoid adding another object when I dont need it.
    My smartshape is a right arrow (indicating "Begin"), and I dont want a squarish click box sitting on top of a triangle because that just shows the hand pointer even if the cursor isn't exactly over the arrow button because it enter the clickbox area.
    Thanks,
    Sean

    Select the Smart Shape button , go to Properties > Timing accordion > Pause After and set the number of seconds from the beginning of the slide for it to pause.

  • How to get the user entered data?

    Hi all,
    I have created an HTMLB DynPage component.
    In That i have created my input screen with textboxes using response.write method.
    i have added one onConfirm event on which the data whould validate.
    so onConfirm method im trying to get the data with request.getParameter method which returns null...
    how to do...how to get the user entered data to do my validations...can anyone plz advice.
    Thanks,
    Viswes

    Hi
    inputfield or textbox component entered directly using response.write(...) are not htmlb , but html.
    to create portal input field (ie HTMLB), you should do something like
    this in the doProcessBeforeOutput member function
    InputField field1 = new InputField("Id1");
    field1.setSize(8); // 8 characters
    this.getForm().addComponent(field1);
    and in doProcessAfterInput member function
    InputField field1 =
    (InputField) this.getComponentByName("Id1");
    you can then manipulate the content of the field.
    Hope this help,
    Guillaume

Maybe you are looking for

  • Logical command in ABAP.....Urgent

    Hi,   i am pretty new using ABAP program so i neeed help urgently. i am trying to move a file on the application server from one directory to the other and i was using the open dataset function to do that. but the file i am trying to move is pretty b

  • How to call external Perl routines from Pl/SQL - Urgent

    Available software in the Test Environment: 1. Sun Unix 2.8 2. Oracle 8.1.7 ( 8i) 3. Perl 5 Iam trying to call/execute perl scripts from PL/SQL using the DEMO_RDBMS.mk. I am able to call C scripts from PL/SQL, but actually want to call Perl scripts.

  • I have Updated My Ipad with IOS 5 and lost Apps off the ipad?

    But they are still on my Itunes account. How do I transfer them back onto the Ipad. I have tried to resync and that has not worked. please help? I ahve not lost all my apps but about 5 apps they are sitll on my account though

  • Is there an easy way to create a random character?

    I tried generating a random int with the Random class and casting it to a char, but when I try to print it (which is the whole thing I want), it prints it as a number. How do I print it as the character? Edited by: drummerp on Dec 1, 2009 3:05 AM

  • Unable to create folders for apps on springboard

    I was successful at creating folders for one of my sons on his Ipod Touch, but my other son's Ipod won't allow me to do it. Is there a setting that needs to be turned on or off or what? With my sucessful situation, I simply held my finger on one of t