Solution 1 :

Hoply can help. You can add this code, just adjust it with your code

<?php
//hide comma with replace function
$book_pages= str_replace(",", "", $book.pages);
?>

Solution 2 :

Sorry my bad, I forgot to tell that is written in FreeMaker.

So the solution is just writing it with some FreeMarker logic:

<input type="number" class="form-control" name="pages" value="${book.pages?c}">

Problem :

I want to display an integer number in html which I get from a rest api call as json response. But in my HTML page it is displayed with a comma. So now when I want to accept the fields and save my record, the field shows a error message: “Please enter a valid schema”.

That’s my code:

HTML:

<div class="mb-3">
    <label for="disabledTextInput" class="form-label">Pages</label>
    <input type="number" class="form-control" name="pages" value="${book.pages}">
</div>

The field in json:

"pageCount": 1531

That’s the result with separator:

enter image description here

Comments

Comment posted by Heretic Monkey

The format of the displayed number depends on the regional settings of the user’s OS. If you want to get the number as a Number (without formatting), you can use the

By