Skip to main content

I have the following problem:

We had the following code in an html file <input type=text size=14 maxsize=12 value=%%Sum%%>

If we set the value 15 to the Sum-variable in the cbl-program, the html-source code in the browser would look like this: <input type=text size=14 maxsize=12 value=       15,00>

but in effect the browser would deprecate the leading spaces, showing 15,00 (aligned to the left) in the textbox.

Now, W3C html-standards dictate, that attributes values need to be enclosed by hyphen(?), as in: <input type="text" size="14" maxsize="12" value="%%Sum%%">

But now, using this format, the browser DOESN'T deprecate the leading spaces. Instead it treats the value as a string, thus showing the leading spaces followed by 15,00 in the textbox. The leading spaces are also aligned to the left, which makes the desired value of 15,00 show up in the middle of the textbox.

The Sum variable is of the pic ---.---.---,99 type. And the value is submitted to the html-file as a external-form. Do you guys have similar code? How have you resolved this issue? Do I really have to convert the numeric field to an alphanumeric one before sending it out?

Appreciating the help!

Raphael


#htmlvalueattributenumericvariable

I have the following problem:

We had the following code in an html file <input type=text size=14 maxsize=12 value=%%Sum%%>

If we set the value 15 to the Sum-variable in the cbl-program, the html-source code in the browser would look like this: <input type=text size=14 maxsize=12 value=       15,00>

but in effect the browser would deprecate the leading spaces, showing 15,00 (aligned to the left) in the textbox.

Now, W3C html-standards dictate, that attributes values need to be enclosed by hyphen(?), as in: <input type="text" size="14" maxsize="12" value="%%Sum%%">

But now, using this format, the browser DOESN'T deprecate the leading spaces. Instead it treats the value as a string, thus showing the leading spaces followed by 15,00 in the textbox. The leading spaces are also aligned to the left, which makes the desired value of 15,00 show up in the middle of the textbox.

The Sum variable is of the pic ---.---.---,99 type. And the value is submitted to the html-file as a external-form. Do you guys have similar code? How have you resolved this issue? Do I really have to convert the numeric field to an alphanumeric one before sending it out?

Appreciating the help!

Raphael


#htmlvalueattributenumericvariable

The field you are using pic ---.---.---,99 is a numeric edited field which places it in the category of alphanumeric and not numeric.

HTML versions prior to HTML5 do not define a numeric input type so you are always dealing wth alphanumeric data which will need to be validated and formatted using script, styles, etc.

If you simply desire to right justify the field you could add the following style to its description:

style="text-align: right"

Thanks.


I have the following problem:

We had the following code in an html file <input type=text size=14 maxsize=12 value=%%Sum%%>

If we set the value 15 to the Sum-variable in the cbl-program, the html-source code in the browser would look like this: <input type=text size=14 maxsize=12 value=       15,00>

but in effect the browser would deprecate the leading spaces, showing 15,00 (aligned to the left) in the textbox.

Now, W3C html-standards dictate, that attributes values need to be enclosed by hyphen(?), as in: <input type="text" size="14" maxsize="12" value="%%Sum%%">

But now, using this format, the browser DOESN'T deprecate the leading spaces. Instead it treats the value as a string, thus showing the leading spaces followed by 15,00 in the textbox. The leading spaces are also aligned to the left, which makes the desired value of 15,00 show up in the middle of the textbox.

The Sum variable is of the pic ---.---.---,99 type. And the value is submitted to the html-file as a external-form. Do you guys have similar code? How have you resolved this issue? Do I really have to convert the numeric field to an alphanumeric one before sending it out?

Appreciating the help!

Raphael


#htmlvalueattributenumericvariable

I would also consider using the html 5 "pattern" attribute with a custom regular ex,

as this will allow more modern browsers the ability to ensure the data is entered correctly.

Also, consider using css rather then embedding the style directly on the field.

(note: modernizr can be used for sub-html5 browsers)


I have the following problem:

We had the following code in an html file <input type=text size=14 maxsize=12 value=%%Sum%%>

If we set the value 15 to the Sum-variable in the cbl-program, the html-source code in the browser would look like this: <input type=text size=14 maxsize=12 value=       15,00>

but in effect the browser would deprecate the leading spaces, showing 15,00 (aligned to the left) in the textbox.

Now, W3C html-standards dictate, that attributes values need to be enclosed by hyphen(?), as in: <input type="text" size="14" maxsize="12" value="%%Sum%%">

But now, using this format, the browser DOESN'T deprecate the leading spaces. Instead it treats the value as a string, thus showing the leading spaces followed by 15,00 in the textbox. The leading spaces are also aligned to the left, which makes the desired value of 15,00 show up in the middle of the textbox.

The Sum variable is of the pic ---.---.---,99 type. And the value is submitted to the html-file as a external-form. Do you guys have similar code? How have you resolved this issue? Do I really have to convert the numeric field to an alphanumeric one before sending it out?

Appreciating the help!

Raphael


#htmlvalueattributenumericvariable

What I want is, that there are neither leading nor trailing spaces whenever I have a default value assigned to the value-attribute. Apparently, using %%!s trims trailing spaces from strings, but is there an equivalent function which I can use to eliminate leading spaces?