473,383 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

changing values on submit

130 100+
hello all

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
  1. function check(y)
  2. {
  3.     var z = new RegExp();
  4.     z.compile("^[^@]+@[^@.]+\.[^@]*$");
  5.     x=document.getElementById(y).value
  6.     if (z.test(x)) 
  7.     {
  8.         flag=0;
  9.     }
  10.     else
  11.     {
  12.         flag=1;
  13.     }
  14. }
can i add getElementById("hidden_form_filed").value="email"
to the 'if'

****** edit *****

i try and yes it is possible like this :

Expand|Select|Wrap|Line Numbers
  1. function check(y)
  2. {
  3.     var z = new RegExp();
  4.     z.compile("^[^@]+@[^@.]+\.[^@]*$");
  5.     x=document.getElementById(y).value
  6.     if (z.test(x)) 
  7.     {
  8.         flag=0;
  9. document.getElementById("hidden_form_filed").value="email"
  10.     }
  11.     else
  12.     {
  13.         flag=1;
  14.     }
  15. }
sorry for the post if its spam kill it
Nov 12 '07 #1
1 967
acoder
16,027 Expert Mod 8TB
sorry for the post if its spam kill it
Nah, not spam.

It happens to many: finding the answer after posting here.

Glad you solved the problem.
Nov 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: jeff | last post by:
Hello, I have a form that submits it's values to a pop-up window. I've simplied the code: <form name="formname" action="action.php" target="windowName" method="post" onsubmit="window.open('',...
8
by: Ryan | last post by:
I have a hidden field as such: <INPUT TYPE=\"hidden\" name=xmlfield > I have a button that i want to use to call a function to change the value: <INPUT TYPE=submit VALUE="Display XML"...
2
by: programming | last post by:
I just would like to re-explain the problem i am having as i had not received any posts, so i might of explained in poorly. The problem i am having is NOT parse error related, more or less a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.