1

Let's say I have a form where user can add items dynamically and enter a % for each item. The total percentage for all fields should equal 100%.

If user decides to create 3 fields equally weighted how convey and validate that each field contains infinite recurring decimal points (e.g. 33.333333...)?

Field 1: [33.33%] Field 2: [33.33%] Field 3: [33.33%]

Thanks,

1

I like the way Buxfer handles this. It is a shared expense tracking website. When you add a shared expense of 100 USD and add the sharing parties, it offers an option of uneven split. enter image description here

If I select uneven split. It breaks up the text area into three and tries to split everything equally. In a case like 100/3, it gives the last precision point to one sharer and keeps that person on top so that the user knows the deviation.

enter image description here

Notice that it keeps giving the option of going back to even split, add more sharers and remove existing sharers. I find this UI to be usable.

Hope this real world example is of some help!

  • This is great thanks @Harshal, what happens in your example when you click EVEN SPLIT? For the 100/3. Will it show 33.33 for all three items? – Adolfo Perez Jun 20 '17 at 17:54
  • @AdolfoPerez notice that the extra fraction is added in the first sharer. The first one is 33.34 and all others are 33.33. For any precision level, you'll have to make one slightly bigger. – Harshal Jun 20 '17 at 18:10
  • Yes I noticed that sharer1 has 33.34 but was wondering what happened when you clicked again EVEN SPLIT since given that scenario Even Split is not possible. – Adolfo Perez Jun 20 '17 at 18:36
  • 1
    @AdolfoPerez Ohh. No. Even split will collapse that form with individual options and go back to text area where the fields are just comma separated. I guess internally they do the last precision point adjustment. – Harshal Jun 21 '17 at 0:43
2

Allow the user to input fractions because that makes more sense in some situations, as your example demonstrates.

If you'd like to ensure that they work with only one format at a time, you can add a toggle that exclusively enables input of fractions or decimals (you'll have to convert any inputted values between fractional values and decimal representations, but that's a job for your developers to figure out. It's not a difficult problem to solve).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.