Blazor InputNumber decimal format - decimal

Ideally I would like to apply Math.Round() method to my Blazor's InputNumber in order to remove the .xx from a decimal value.
<InputNumber class="someClass" #bind-Value="#DcValue"></InputNumber>
Please note the model's DcValue is decimal and will have to stay decimal.
Is there any way of doing this?

I ended up creating a custom control to manage that requirement. More details here.

Related

JSF hour-minute input

I would like to know what is the prefered way to handle hour-minute input fields in JSF.
I am using JSF2.2 with primefaces 5.2
I would like to have one input field for hours and one for minutes and have the value saved to dabase in decimal and fraction format.
Then it would be nice alo so have a converter for this, for example if you have the need to store in minute or second precision. Is there already something availabe or do I realy have to write one of my own?

Update XPages text value from within a repeat?

I feel like I'm just not understanding something about the XPages lifecycle here. I have an xp:text control, with a value of viewScope.count. Initially, that's null. After the xp:text, I have a repeat that's performing a calculation and returning an array of objects for its value. At the end of the repeat's value section, I'm trying to update the xp:text with a count of the things in the array:
viewScope.count = myArray.length;
The xp:text isn't being updated with that value, though. Should this work? Do I need to do a manual refresh of the xp:text when I modify viewScope.count? TIA!
You should be able to use the index of the repeat to give you a count.
Take a step back and rethink the approach. Inside the code you use for your repeat you update something outside.
Not looking at 'does it work' I would claim 'bad idea'. Such side effects make maintenance a nightmare (and are not very MVC).
The better approach (IMHO):
Create an object data source. AFAIK that can be a JSON object if you are not comfortable with Java. That object would have all the needed properties for your repeat and your counter display. It serves as your model.
Then bind the repeat and the text field to the model and you are good.
Makes sense?

Double.toString without the exponential notation for large values

In my JSF2 application, I want my double value to be displayed without exponential notation. Is it possible?
I cannot use NumberFormat or DecimalFormat since its going to change my data type to String.
I understand from Java documentation, if my double value is less than 10^-3 or greater than or equal to 10^7, then it is represented in so-called "computerized scientific notation"(Ref: http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#toString()).
And, In JSF while displaying a double value it will internally convert any data type to string.
For example, if my double value is 9999999999 it is getting displayed as 9.9e^9. I want it to be displayed as it is. i.e 9999999999
But, it there any possibility to override this character of Double or is there any other approach to solve this issue?
The correct solution for problems like this is to pass the internal data type around for as long as possible. Just at the moment when you display it to the user, you format it properly using DecimalFormat.
So you have to find all the places in your JSF2 UI where you display doubles and use the proper formatters there.
Note that DecimalFormat isn't threat safe, so you have to create a new formatter for each request (at least).
If your code provides a double or Double, you can display that value directly in the page using a converter:
<h:outputText value="#{myBean.someDoubleValue}">
<f:convertNumber pattern="0"/>
</h:outputText>

How to get the sequence number of $Revisions field?

Actually I have to take the sequence number in $Revisions field.
Try this, #Elements($Revisions)
As far as I know, the only way to get this information is with the NSFItemQueryEx call in the Notes C API.

how to write xml schema(XSD)

I want to right one XML schema(XSD)
in which
element have multiple occurences and have one attribute ID
I want validate if borrower's ID attribute have a value equal to 1 then all its subelement must have some value.
is this possible with XSD?
Please suggest me if their is a way to achieve this
thanks
Not possible as far as I can remember, but it is totally OK to first validate the XML using XSD and then have some additional, application-specific validation logic on top of that.

Resources