mattwood1 / ecb

Automatically exported from code.google.com/p/ecb
0 stars 0 forks source link

Job Fields input #25

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I want to be able to make some if the job fields in the form to be entered in a 
uniform way, for instance the Registration: to be in the format of 
[A-Z]{2}[0-9]{2} [A-Z]{3} 
So that it would post the format of the registration to the database as 
EF55 YHZ even though its entered EF55YHZ 

Original issue reported on code.google.com by matthew....@gmail.com on 2 Oct 2013 at 11:14

GoogleCodeExporter commented 9 years ago
I don't think I want the form validated though, I was thinking more along the 
lines of it being formatted. So as you type it puts the spaces in for you, I 
thought I'd be able to do that with Javascript. Also thinking of the same for 
name and address, so that when posted server side it can change the first 
letter of each word to a capital letter ect...

Original comment by matthew....@gmail.com on 2 Oct 2013 at 11:14

GoogleCodeExporter commented 9 years ago
I don't think JS can do this, but with those regular expressions you could do 
this using PHP. It would detect which type of number plate was typed and then 
add spaces accordingly.

Original comment by matthew....@gmail.com on 2 Oct 2013 at 11:15

GoogleCodeExporter commented 9 years ago
<input type="text" value="" name="registrationMark" onblur="return 
this.value=this.value.toUpperCase().replace(/ +?/g, '');">

Original comment by matthew....@gmail.com on 2 Oct 2013 at 11:25

GoogleCodeExporter commented 9 years ago
Still prefer PHP to parse the string to format the REG and Names.

Original comment by matthew....@gmail.com on 2 Oct 2013 at 11:26