I have a dataset with a load of number fields used to record scores from a scoresheet. The fieldvalue type is set to number, and the user input text box is also set to number. Not all the input boxes will be filled as in a best of three game you may only have two sets of scores. If the user provides no input to the field then the dataset attempts to store this as a URL - rather than a number (or a 0 would be useful).
I want to sum these scores and present them back to the user. I am using an array to hold various calculation values as I need scores/winners etc for each game, set and overall match.
When I sum the values from the dataset and try to store them in my array with a no user input field it returns a set of appended strings:
//Scores = itemObj.h11 + itemObj.h12 + itemObj.h13 + itemObj.h21 + itemObj.h22 + itemObj.h23 + itemObj.h31 + itemObj.h32 + itemObj.h33 + itemObj.h41 + itemObj.h42 + itemObj.h43 + itemObj.h51 + itemObj.h52 + itemObj.h53 + itemObj.h61 + itemObj.h62 + itemObj.h63 + itemObj.h71 + itemObj.h72 + itemObj.h73 + itemObj.h81 + itemObj.h82 + itemObj.h83;
(I've written this longhand so you can see what is happening. The below is how it is actually calculated in a function that is called to resolve each game)
Scores = Scores + homepoint;
The result with a no user entry to one field:
The result with the first three data values filled and then blanks:
Setting a 0 in the field, rather than leaving it blank, correctly stores a 0 as a number and the calculation resolves correctly. I don't really want to make every user input field "required" and have the user set it to 0 as it is not often that a third game is played and there are already a lot of values to input.
The image below shows the input scoresheet on the webpage.
The input boxes are numbered (#inputx):
When the user tabs from one input box to the next the sequence is:
This repeats across the whole page for all 8 sets of input boxes and is really counter intuitive. I don't know what sets the order for which box gets tabbed to, as it clearly isn't #input in ascending order.
Any help much appreciated :-)