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 1022585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:29:17+00:00 2026-05-16T11:29:17+00:00

Site . This code is not optimized nor is it the best method. If

  • 0

Site.

This code is not optimized nor is it the best method. If you have any ideas to improve anything, let me know.

Please visit the site to get an idea of the data.
I have used Dan G. Switzer, II’s calculation plugin [adding .sum() .max() .min() .avg()]

The validation requirement i’d like to have is to make sure nothing conflicts with that user’s already determined range. Also, that there are no gaps in the range.

For example give

Brian 40 50 1200
Brian 50 70 1200

I dont want to the user to be able to set the first 50 to 39 because 39 would be smaller than 40. I dont want them to let 50 be set to anything higher than 50 because it would overlap the next range.

Any good ideas? perhaps actually running through all the values and then making a real range and then on BLur have it check to make sure no range is actually overlapped or gapped.

Each unique input is defined as id=NAME, so if I wanted to reference all the inputs of Brian, I could use $("input[id='Brian']").each() or if I wanted to reference all the START inputs of Brian, I can use $("input[id='Brian'][name='start[]'").each()

Edit:

One thing to note is that the page is PHP, and PHP is ran to populate the inputs via a CSV file. It will always start with correct data, and PHP can be used to help create ranges.

because of this I was thinking of just disabling the START field, because it will always populate the next range. However, I will be adding the ability to delete rules, so that can get messy if they are limited in what they can do.

  • 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-05-16T11:29:18+00:00Added an answer on May 16, 2026 at 11:29 am

    One of the problems I see is that the Name fields is editable. If the field is changed, all the overlapping has to be recalculated. Not only is that is a performance issue, it is also a usability problem: what if one wants to change a name and the script, seeing discrepancies, forbids it?

    A solution would be to change the table to one resembling the diagram below:

    [ Add Employee ]
    
    |    Name    |  Start  |  End  |  Wages  |
    ==========================================
    |            |    0    |   50  |   100   |
    |    Brian   |   50    |   70  |   150   |
    |            |  100    |  150  |   200   |
    |                 [ Add Rule ]           |
    ------------------------------------------
    |   Another  |    0    |  ...  |   etc   |
    

    The [ Add Employee ] button would ask for a name and add a cell in the first column, and a line in the next three: with a default Start value of 0. The user can then enter data on the next fields, and can [ Add Rules ] as wanted. A good restriction could be to lock the values of the Start column and set them to the End value of the previous line.

    $('#Brian .LineN input.start').val(
        $('#Brian .LineN').prev().find('input.end').val()
    );
    

    Then adding a comparison function to check if the End value is lower than the Start value is trivial to implement.

    Deleting a rule could simply follow the same procedure as for adding a line: the line below the one deleted (if any) would set its Start value as the now previous line’s End.

    The real difficulty would be to insert lines at arbitrary points. I’m not going to think about that one, though.

    EDIT:
    If a rewrite is out of the question, then just disabling the start should be enough. However, IMHO I would rather (re)write something with no caveats than spend time later on numerous bugs and feature requests.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey. I know this is not a 'refactor my code' site but I made
I have downloaded the sample code from this site for FTP Client http://www.lysesoft.com/products/andftp/index.html But
I've used this code to have a like btn on my site: <iframe src=http://www.facebook.com/plugins/like.php?href=URL_OF_YOUR_WEBSITE&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=80&amp
This is not my code. I just arrived at this site and am doing
I have this code to check if the site is up or down: require
Is there any web-site where I could post my java-code (not very long, around
I'm trying to code this site (keyword trying) and I'm trying to figure out
Got this code for a viewscroller from the apple developers site. @synthesize scrollView1, scrollView2;
Currently this code generates a colored hyperlink to an ad listing on my site.
I found this code on a hacked site, what does it do exactly? It

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.