Board index » Web Programming » Combine first name and last name

Combine first name and last name

Web Programming245
I have a form that asks for:



Contact name:

Email:



That works fine. However, I find that some people only enter their first

name, so I want to change the form to this:



First name:

Last name:

Email:



When the user clicks Submit, I would like a field included that is made up

of the first two fields, eg realname = 'Bill Jones". So a new field is

created which combines the first two fields.

The code is something like: "realname" = "firstname" + "lastname".



Does anyone know how to do this?


-
 

Re:Combine first name and last name

Use Javascript



<form>

<INPUT TYPE="TEXT" NAME="firstname"><br>

<INPUT TYPE="TEXT" NAME="lastname"><br>

<input type="submit" value="Submit" name="Submit" onClick="this.form.realname.value = (this.form.firstname.value) + ' ' +

(this.form.lastname.value)">

<INPUT TYPE="hidden" NAME="realname">

</form>





--



_____________________________________________

SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]

"Warning - Using the F1 Key will not break anything!" (-;

To find the best Newsgroup for FrontPage support see:

www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx">www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx

_____________________________________________





"Jane Here" <cibhere@yahoo.com>wrote in message news:Ob02yEPkGHA.2200@TK2MSFTNGP05.phx.gbl...

|I have a form that asks for:

|

| Contact name:

| Email:

|

| That works fine. However, I find that some people only enter their first

| name, so I want to change the form to this:

|

| First name:

| Last name:

| Email:

|

| When the user clicks Submit, I would like a field included that is made up

| of the first two fields, eg realname = 'Bill Jones". So a new field is

| created which combines the first two fields.

| The code is something like: "realname" = "firstname" + "lastname".

|

| Does anyone know how to do this?

|

|

|

|

|

|





-

Re:Combine first name and last name

Thanks - works great.



"Stefan B Rusynko" <sbr_enjoy@hotmail.com>wrote in message

Quote
Use Javascript



<form>

<INPUT TYPE="TEXT" NAME="firstname"><br>

<INPUT TYPE="TEXT" NAME="lastname"><br>

<input type="submit" value="Submit" name="Submit"

onClick="this.form.realname.value = (this.form.firstname.value) + ' ' +

(this.form.lastname.value)">

<INPUT TYPE="hidden" NAME="realname">

</form>





--



_____________________________________________

SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]

"Warning - Using the F1 Key will not break anything!" (-;

To find the best Newsgroup for FrontPage support see:

www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx">www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx

_____________________________________________





"Jane Here" <cibhere@yahoo.com>wrote in message

news:Ob02yEPkGHA.2200@TK2MSFTNGP05.phx.gbl...

|I have a form that asks for:

|

| Contact name:

| Email:

|

| That works fine. However, I find that some people only enter their first

| name, so I want to change the form to this:

|

| First name:

| Last name:

| Email:

|

| When the user clicks Submit, I would like a field included that is made

up

| of the first two fields, eg realname = 'Bill Jones". So a new field is

| created which combines the first two fields.

| The code is something like: "realname" = "firstname" + "lastname".

|

| Does anyone know how to do this?

|

|

|

|

|

|









-

Re:Combine first name and last name

Bujar Mehmeti

-