is it possible to change values of a form when submit?
i have a form that only have one field and i want to check if this filed contain
plain string or email
i check with regexp if its mail if not i want to update a hidden filed to submit to php
is it possible ?
snippt:
Expand|Select|Wrap|Line Numbers
- function check(y)
- {
- var z = new RegExp();
- z.compile("^[^@]+@[^@.]+\.[^@]*$");
- x=document.getElementById(y).value
- if (z.test(x))
- {
- flag=0;
- }
- else
- {
- flag=1;
- }
- }
to the 'if'
****** edit *****
i try and yes it is possible like this :
Expand|Select|Wrap|Line Numbers
- function check(y)
- {
- var z = new RegExp();
- z.compile("^[^@]+@[^@.]+\.[^@]*$");
- x=document.getElementById(y).value
- if (z.test(x))
- {
- flag=0;
- document.getElementById("hidden_form_filed").value="email"
- }
- else
- {
- flag=1;
- }
- }