Cerebrus, sounds like you've been around the block once or twice ;-) Of course my client insists that this be a single textbox for latitude and one for longitude.
Thanks for your work on that regex, I will play around with it and see what I can use. We managed to get this working to our clients expectations after a little clarification on their part. Apparently latitude and longitudes work as a percentage of 100, and not like a clock like I had thought... So there is no rounding to figure out, the only thing left for me to do was add logic to automatically add the decimal point after two numbers were typed for latitude and after three numbers were typed for longitude (using JavaScript). The only thing left for me to do would be to somehow mask the display to show the degree minute and second symbols...but our client is used to not seeing this mask now so they are happy with it as is. On Dec 18, 3:14 pm, Cerebrus <[email protected]> wrote: > That's a good suggestion and it occurred to me earlier. But I rejected > it based on my experiences with obstinate clients (assuming that the > project requirement would *insist* on a single textbox. Or maybe I'm > getting too paranoid, eh, Rhaazy ? > > On Dec 18, 3:37 am, starmister <[email protected]> wrote: > > > > > Given the complexity of dealing with the conversions between degree/ > > hour minutes seconds notation and decimal form, you may want to create > > a custom control that is comprised of several text boxes and a drop > > down or option control, in order to ensure valid entries. > > > Do the internal conversion processing (instead of using split() > > function) on a button click to 'submit' it or after your control loses > > focus (user tabs out, clicks somewhere else): > > > 1) set up three text boxes aligned in a row, for collecting numeric > > values comprising one total entry. The first box would allow numbers > > 0 to 180, the next two would hold values 0 to 59. In the first box, > > use a simple RegEx allowing 1 to 3 digits and value range of 0 to 180. > > For the second and third box, use a RegEx to check for two digits, > > and values 0 to 59. After validation, or after tabbing out, you can > > prepend a '0' zero to the entered value, if the value entered is less > > than 10. (If you need decimal portion of second, you could add > > another text box.) > > > 2) to handle negatives, set up a drop down box or option control for > > +/- or, if you want to see cardinality indicators, you'll need one for > > N/S and one for E/W depending on whether collecting a longitude or > > latitude entry. > > > Hope this idea is helpful. > > > On Dec 17, 3:19 pm, rhaazy <[email protected]> wrote: > > > > I added a couple of regular expression validators to my asp fields but > > > I am having difficulty coming up with a regular expression for this, > > > anyone have any suggestions? > > > My RegEx-Fu is very poor. > > > > Any kind of latitude / longitude regular expression would be nice, > > > preferably one that uses the signed and unsigned decimal as opposed to > > > cardinal direction. > > > I have googled this for a while but can't find any example to use as a > > > good starting point. > > > > (\d{1,3} \d{1,2}\.\d{1,2} [NSEW]) > > > latitude or longitude coordinates in the form 46 37.73 N > > > > but I would rather have this be something closer to: > > > 46°37'73" (46 37.73 S would be better as -46°37'73") > > > > Again, any feedback is appreciated. > > > > On Dec 16, 3:05 pm, Sharp ArunKumar <[email protected]> wrote: > > > > > Your validation easly made by various string functions,First you valid > > > > the data then you can format the data as you like. > > > > First input data Split into three value , Assume user give 45.0003 > > > > in the LLtextBox > > > > > Then you can split the value into two look the following C# code > > > > > string[] s ; > > > > s = LLtextBox.Text.Split('.'); > > > > int Longitude= Convert.ToInt16(s[0]); //45 > > > > int Latitude= Convert.ToInt16(s[1]); //0003 > > > > //then again latitude value into two using substring functions > > > > string v1= s[1].Substring(0, 2); //00 > > > > string v2= s[1].Substring(2); //03 > > > > if user give less then three digit value eg 87 > > > > call above split function > > > > now s[0] contain 87 > > > > but s[1] contain Null value ,then you can assign default value > > > > Then you can format the data using string functions like insertchar > > > > ----------------------- > > > > Arun Kumar > > > > > On Dec 16, 9:36 pm, rhaazy <[email protected]> wrote: > > > > > > Thanks for your reply. > > > > > > The data entered will no larger than 7 numbers with 4 always to the > > > > > right of the decimal. > > > > > A valid Latitude value is -90 to 90 > > > > > > A valid Longitude value is -180 to 180 > > > > > > the minutes and seconds must be no larger than 59. > > > > > > A few more examples > > > > > > 45.0003 -> 45°0'3" > > > > > -145.3453 -> -145°34'53" > > > > > 123.7592" -> 124°16'32" - this example rounds to get rid of invalid > > > > > minutes/seconds > > > > > 87 -> 87°0'0" > > > > > -23.59 -> 23°59'0" (this number will be saved to database as -23.5900 > > > > > > Besides the validation I am trying to figure out how the text will get > > > > > formated. > > > > > My thoughts are that I would have to create some kind of "on leave" > > > > > logic for the textbox. > > > > > Is there a way to mask the input of the textbox in asp.net? > > > > > > On Dec 16, 11:03 am, Cerebrus <[email protected]> wrote: > > > > > > > You should be able to do it easily using RegexValidators or > > > > > > CustomValidators. Or write your own textbox controls that > > > > > > encapsulate > > > > > > the behaviour required. > > > > > > > If you need help with the Regex, please provide more > > > > > > details/examples > > > > > > on the type of data that is valid and invalid. > > > > > > > On Dec 16, 8:23 pm, rhaazy <[email protected]> wrote: > > > > > > > > Forgot to add that this is asp.net > > > > > > > Data input will be like 123.4523 -> 123°45'23" > > > > > > > > On Dec 16, 9:54 am, rhaazy <[email protected]> wrote: > > > > > > > > > I have to add a couple of controls to my form for input of > > > > > > > > geographical cooridinates(Degrees Minutes Seconds) > > > > > > > > > I was wondering if anyone here has some useful suggestions for > > > > > > > > input > > > > > > > > controls or data validation. > > > > > > > > > I've been searching the google for a while but can't find > > > > > > > > anything > > > > > > > > very useful. > > > > > > > > > Thanks.- Hide quoted text - > > > > > > > > - Show quoted text -- Hide quoted text - > > > > > > > - Show quoted text -- Hide quoted text - > > > > > > - Show quoted text -- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text -
