Unable to format the integer values in text boxes

Asked By 0 points N/A Posted on -
qa-featured

Hi

   In my application, i have to format the integet values in JavaScript. I am using json object to fetch the values.I would like handle the formatting functionality in JavaScript.

Code:

 oServerSideTextBox = top.ltop.document.getElementById("jsonTextBox").value;
              if (oServerSideTextBox != "") {

                var oServerJSON = eval("(" + oServerSideTextBox + ")");
                
                 var i;
                 
                 for (i = 0; i < oServerJSON.length; i++) {
                     var row = oServerJSON[i];
                     var Val = row.Value;

                     $('#' + row.Name).val(Val);                   
                     
                 }
             }

 

I want to format the numeric values like 12345 -? 12,345

 

Thanks in advance

jdiaz

SHARE
Best Answer by maryredington
Best Answer
Best Answer
Answered By 0 points N/A #93170

Unable to format the integer values in text boxes

qa-featured

Nope. I don't think there is anything in JavaScript to do these kind of things. But, however you may try this:

Function formatnl (NUM, length)

{var r = "" +num;

While ( r.length <length) 

{ r="0" + r;

} Return r;

}

Cheers.

Answered By 0 points N/A #93172

Unable to format the integer values in text boxes

qa-featured

Sorry for the delay in getting back. Thanks a lot for the solution it really helped me.

Related Questions