You'll probably have to code some elaborate logic for the variable space of "unoccupied" figures and commas. Why not position the dollar sign and the amount separately instead of creating a custom format? However, the problem of figuring out the width of the biggest amount before you are able to determine position coordinates remains ...
Have you tired setting the alignment of the field data to 'Right'?
Since the numeric field usually does not have a defined length, how will you know how many leading spaces to provide?
What about this logic?
Seperate the field into 2 columns, one just for the dollar sign, the other for the dollar amount.
If an amount is input into the dollar amount field, populate the dollar sign field with a dollar sign.
I think this logic would work, but could anyone help me with the code?
I think that's a good idea. You could then use code like the following as the custom Validate script of the amount fields:
// Show the corresponding dollar sign if the value is not blank
getField("dollarsign1").display = event.value ? display.visible : display.hidden;
// Show the corresponding dollar sign if the value is not zero or blank
getField("dollarsign1").display = +event.value ? display.visible : display.hidden;
You should set up the dollar sign fields so they are read-only and the default value is set to "$".
In the first script, is will display the dollar sign if there is any numeric value in the field, including "0". Only if the field is blank will the dollar sign not show.
In the second script, the dollar sign will not show if the field is blank or equal to zero.