leading zero for phone number disappear after creating new / edting
leading zero for phone number disappear after creating new / edting

Hi,
Made a table with phone column as string, if i ever try to create a new number with leading zero the zero just disappear
e.g 0564564564 (submit) => result = 564564564
I'm using SQL Server 2014 VS 2013
tried running examples locally specifically this example http://localhost:xxxxx/Web/examples/simple/simple.html
edited name and position columns values to a number with leading zero same thing happen zero disappears :S
is it a problem with the way SQL server receives input?
if by any chance there's a temporarily fix for this i'd really be grateful
This question has an accepted answers - jump to answer
Answers
PS:
the number is stored in database without zero (564564564)
for some reason it preserves the leading zero if i have space and any number after, like this:
0564564564 4
and stores it correctly but still it doesn't look clean :/
problem still persists
Tried to use this format +966 for phone number guess what? leading plus sign doesn't save O_O
+966564564564 => submit => 966564564564
other symbols like minus & division work fine why just plus sign
[Edit]
Just gonna use it without plus sign should be OK for now
Hi,
The problem here is that "001" as a number is exactly the same as "1" (again as a number). When considering the numeric representation of data, leading zeros have no additional information so they can be safely dropped.
That is not the case with telephone numbers - although they might look numeric, I think it would be safer to call them strings. That will preserve the leading zero - you could still validate it as having only numeric characters, but in the database store it as a string.
Regards,
Allan
[Edited]
I double checked my model and db for mobile and both appears to be (strings) :
mobile varchar(MAX) in table
public string mobile; in model
same thing goes for iqama_no
Yet they are treated as an int (no leading zeroes) which doesn't make any sense
I can provide a copy of the project if it's gonna help
Thanks for the extra information. I've just been looking into this and it is certainly a bug in the Editor .NET libraries. When it gets a request from the client-side it tries to guess the data that that was submitted and unfortunately it is getting it wrong for such values.
As a workaround, in the
DtRequest.cs
file there is a function called_HttpConv
. At the top of it you can add:which will allow it to work as expected. I'll have that in the next release.
Longer term I'm going to tie the data types from the model to the data type that the submitted data is cast to on submission to resolve this.
Thanks for letting me know about this issue.
Regards,
Allan
Works fine now thanks also the overflow error disappeared too, this solved both problems :D
[Edit]
i just had to replace the new DataTables.dll with the one in lib folder
problem is solved validators working without any problem
Thanks!!