January 1st, 2013, 03:36 AM
Right-justifying 1 field in a line of 5
if have the following:
I want #theQty#, a number, to be right-justified with a fixed-width. I've tried many variations without success.
January 2nd, 2013, 11:10 AM
I don't think it's possible that way. You can wrap it in a span and float right but that won't work with it being in the middle of other elements. You may need to try writing a small function that pads it with (ASCII non-breaking space)
January 2nd, 2013, 08:00 PM
kiteless, thank you. This is really weird because I went looking for my post, under my log-in name, to update some experiment results and couldn't find it. So, assuming I had been dreaming, I started a new thread in the CSS forum (Intraline: 3 items left-aligned, 1 right-aligned). Your suggestion is interesting - do the right-justify via a script or function. Thanks again, I'll work on that!
Last edited by new2cfrb; January 2nd, 2013 at 08:03 PM.
January 2nd, 2013, 10:46 PM
ok, got quite a lot further but I'm stumped on a bit of syntax.
I have several variables sp1, sp2, sp3. I want to assign the contents of one of them to varx. The choice of source variable is decided by another called ind. Now, I can use a series of CFIF's or a dynamic address something like:
cfset varx = #["sp"&#ind#]#
Anyone know the correct syntax?
January 2nd, 2013, 11:59 PM
You probably want:
cfset varx = variables["sp#ind#"]
January 3rd, 2013, 12:06 AM
Also, this is just some random advice, but those variable names are terrible. "varx", "sp", "ind", "sp1", etc. tell you nothing about what it actually IS. Not sure if this is just because you're testing things out, but don't skimp on descriptive variable names.
cfset paddedQuantity = variables[ "quantity#orderCounter#" ]
Is infinitely more useful.
January 3rd, 2013, 03:32 AM
kiteless - thanks for the syntax, worked a treat and much more elegant. The alignment was enhanced by the adoption of the "Courier New" non-proportional font.
Excellent advice about datanames - I do use more meaningful names in my code (an old (in many ways) Cobol programmer), I was simplifying for the exercise.