none
Column type Number, decimal upto three places

    Question

  • Hi

    i HAVE A REQUIREMENT IN THIS THR IS A COLUMN IN A LIST WHICH IS OF TYPE ="Number" and decimal places allowed is upto 3.

    But when i make an entry toh the list it doesnot validate the field it allows entry of 5.000003 also which i dont want . i want it should not accpt an entry if its more than 3 decimal places. how to do that ???

    ( if user enters 5.000 and enters 5.00003 {it is truncated to three decimal places and becomes 5.000} so it makes duplicate entry in list)

    please help

    Thanks

    Wednesday, April 24, 2013 10:36 AM

Answers

  • Sharepoint field type of "Number" do not have your expected validation. Only way to acheive this either of the below two types

    1. Have some javascript in the content editor of newform to restrict user from typing more than three decimals. You need to hardcode control id/column name to refer the control.

    2. Have your own custom field, In that you can override getvalidatedstring method to add your requirement validation


    Thanks

    Thursday, April 25, 2013 5:57 AM

All replies

  • Are you saying you want the user to be able to enter 5.00003 but only save as 5.000? If so, you can create an event receiver for when an item is added or updated. then you just get the field and truncate it.

    If you are saying you don't want the user to be able to type in 5.00003, and the software prevents the extra characters then you are looking at some validation, which is of course a different case

    Wednesday, April 24, 2013 4:38 PM
  • I want if im allowing decimal upto 3 places only so while entering also i should not allow user to enter any digit after 3 places like 5.0003 should not be allowed it should not let it enter  after 5.000. like if we set a maxlength in single line of text it doesnot allow entry of more characters like that i want.
    Thursday, April 25, 2013 4:08 AM
  • Sharepoint field type of "Number" do not have your expected validation. Only way to acheive this either of the below two types

    1. Have some javascript in the content editor of newform to restrict user from typing more than three decimals. You need to hardcode control id/column name to refer the control.

    2. Have your own custom field, In that you can override getvalidatedstring method to add your requirement validation


    Thanks

    Thursday, April 25, 2013 5:57 AM