Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7748419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:46:50+00:00 2026-06-01T10:46:50+00:00

This seems like such a simple question. I have several Edit boxes on my

  • 0

This seems like such a simple question.

I have several Edit boxes on my xPage. The user may or may not enter an integer value. The fields are set to accept an integer.

I want to to total all of the values in those fields. I have the following, that works, but it seems awfully inefficient. Is there an easier way to do this?

var DeliveryTotal:int = getComponent(ctlName).getValue() == null    ? 0 : parseInt(getComponent(ctlName).getValue());
var Delivery100s:int = parseInt(getComponent("inputTextDelivery100s").getValue());
var Delivery50s:int =  parseInt(getComponent("inputTextDelivery50s").getValue());   
var Delivery20s:int =  parseInt(getComponent("inputTextDelivery20s").getValue());
var Delivery10s:int = parseInt(getComponent("inputTextDelivery10s").getValue());
var Delivery5s:int = parseInt(getComponent("inputTextDelivery5s").getValue());
var Delivery1s:int = parseInt(getComponent("inputTextDelivery1s").getValue());  


DeliveryTotal = isNaN(DeliveryTotal) ? 0 : DeliveryTotal;
Delivery100s = isNaN(Delivery100s) ? 0 : Delivery100s;
Delivery50s = isNaN(Delivery50s) ? 0 : Delivery50s;
Delivery20s = isNaN(Delivery20s) ? 0 : Delivery20s;
Delivery10s = isNaN(Delivery10s) ? 0 : Delivery10s;
Delivery5s = isNan(Delivery5s) ? 0 : Delivery5s;
Delivery1s = isNan(Delivery1s) ? 0 : Delivery1s;

var totalEntered = Number(Delivery100s) + Number(Delivery50s) + Number(Delivery20s);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:46:52+00:00Added an answer on June 1, 2026 at 10:46 am

    Can you compute the values client side? If so then you could use the following jQuery. It selects all the fields with id starting with inputTextDelivery and adds the value together.

    Number(0 +..) will convert blanks to 0 and 0123 will be converted to 123

    var sum=0;
    $('[id^=inputTextDelivery]').each(function() {
        sum += Number(0+$(this).val());
    });
    

    If not you can certainly remove the block of code checking for 0 by

    var totalEntered = Number(0+Delivery100s) + Number(0+Delivery50s) + Number(0+Delivery20s);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like such a simple question, but I have been trying for an
Why does Java not have a file copy method? This seems like such an
This seems like such a simple question, but I'm having such difficulty with it.
This seems like a fundamentally simple question. I have a WinForms dialog box with
This seems like a simple question, but I haven't been able to find the
This seems like a simple question to ask but, is it generally a good
This seems like a simple question but I can't seem to find an answer
I know this is such a lame question to ask, but it seems like
This seems like a basic question, but I haven't found any clear answers. Essentially,
This seems like a basic question, but it's still bugging me. Why doesn't MyObject

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.