![]() |
Can anyone help me
hi everyone,
I new to javascript.here s my objective: !)i need to create a form with few fields like phoneno,website,address etc and one text area. 2) i copy n paste the details in the textarea n when i click d button. it should automatically populate things into the respective fields. here s my logic wt i taught of: 1)read the first line in the textbox and load it into contact person field. 2)find the @ symbol and put it into the respective field and if there are more than 1 mail id load it into the same feild using commas. 3)if the phone no is 10 digits then load it into the mobile field else load the rest it into phone field. 4)find for words like road,street,block,stage,floor etc,if present then load it into the address field till the last comma is encountered. 5)the last digits in the address should be loaded into the pincode field. 6)the last word present in the address after the last comma and before the hyphen should be loaded into the city field. 7)find for www or http and load it into the website field,if not found leave it blank. but m not able to code.. can anyone plz help me out to code. |
Would it not be better to get your users to fill in individual boxes? Whilst this is possible with regular expressions, you may well encounter unforeseen issues when parsing the data, and thus giving you bad data.
|
this kind of smart text recognition, leaves too much room for mistakes or empty matches of the strings that you are looking for, like wildhoney said.
It would be best to avoid it, but if you really need to do it, I think you would need more concise rules for the different text matches that you have, to make it possible, but that would still leave some room for bad data or user mistakes and that would leave to bad user experience if they expect that. |
thanks a lot.yeah i knw u r rite but my company wants it. m trying my best to code but m nt able to come up wit the result. so if u can send me piece of code that would serve a lot.. thanks once again.
Quote:
|
hi tony,
ya u were rite.but my company s demanding for it. i am trying my best to come up with d result. but m nt able to . so if u knw could u plz guide me through it. thanks in advance. |
Tell your company that it is a stupid idea and offer a more suitable alternative, if necessary come to a compromise. If you really, really, really must do what you are asking in the first post then have a go at it and show them how woefully inadequate such a system would be.
|
Quote:
For people like that, arguing won't get you very far so you must show them the errors of their ways, obviously this means more work for you but in the long run the right decision will be made thus resulting in a much easier/cleaner and safer code-base. |
| All times are GMT. The time now is 03:57 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0