fields merging prior to form submitting

N

-Nacho-

Hi group
I have a form with fields for NAME and SURNAME. I need them in
different fields, but I also need to submit them as a unique field
"COMPLETENAME". Is there any way to "capture" them when the user clicks
on the submit button, and merge then, and put the value in a hidden
field "COMPLETENAME" and then finally submit the form?

Thanks a lot in advance.
-
Nacho
 
T

TheBagbournes

-Nacho- said:
Hi group
I have a form with fields for NAME and SURNAME. I need them in
different fields, but I also need to submit them as a unique field
"COMPLETENAME". Is there any way to "capture" them when the user clicks
on the submit button, and merge then, and put the value in a hidden
field "COMPLETENAME" and then finally submit the form?

Yes. Yes there is, and it's extremely easy if you read any kind of Javascript tutorial, manual or guide.
 
R

RobG

-Nacho- said:
Hi group
I have a form with fields for NAME and SURNAME. I need them in
different fields, but I also need to submit them as a unique field
"COMPLETENAME". Is there any way to "capture" them when the user clicks
on the submit button, and merge then, and put the value in a hidden
field "COMPLETENAME" and then finally submit the form?

And if the user has JavaScript disabled or turned off? Whatever you do
at the client must be done also at the server, you can't depend on it
happening at the client.

For what it's worth:

<form action=""
onsubmit="
this.completename.value =
this.firstname.value+this.surname.value;
// Just for debug...
alert(this.completename.value);
">
first name: <input type="text" name="firstname"><br>
surname: <input type="text" name="surname"><br>
<input type="hidden" name="completename">
<input type="submit">
</form>
 
R

Richard Cornford

Randy said:
RobG said the following on 6/18/2006 7:43 PM:

Then 98% or so of the web is useless to them.

Then the remaining 2% get all of their business.

Richard.
 
R

Randy Webb

Richard Cornford said the following on 6/18/2006 9:17 PM:
Then the remaining 2% get all of their business.

Providing they can find the 2% that works for them.
 
R

RobG

Randy said:
Richard Cornford said the following on 6/18/2006 9:17 PM:

Providing they can find the 2% that works for them.

I think you'll find that about 98% of the internet and 90% of the web
works just fine with scripting disabled.

I was more interested in highlighting to the OP that script was being
used on the client for something that really should be done on the
server. Lack of client script support is the most obvious reason, poor
application design is another, poorly specified requirements is a third
(what to do with surnames that have spaces, hyphens or apostrophes).
 
R

Randy Webb

RobG said the following on 6/18/2006 10:55 PM:
I think you'll find that about 98% of the internet and 90% of the web
works just fine with scripting disabled.

That is not my experience. It only takes trying to log into my Banks
site, my ISP's site or just about any other site and you soon find out
that JS is required on most of them.

The trend on the web, whether it is for better or worse, is towards a
dependency on JS, not away from it. It only takes a thought or two about
the technology referred to as "Web 2.0" to realize it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top