<p>I have a field in my form labeled "Name" that will contain both the First &amp; Last name.</p>

<p>Our existing dynamic server (to which the form is being POSTed to), expects two separate fields (first name, last name). </p>

<p>Can I use Javascript to split the user input into two separate variables before the form is posted to the server?  How would I do this?</p>

You can do something like this:
```
```
var yourForm = document.getElementById('yourFormId');
yourform.onsubmit = new function()
{
    var nameBox = document.getElementById('nameBox');
    var fname = document.createElement('INPUT');
    var lname = document.createElement('INPUT');
    fname.type = 'HIDDEN';
    lname.type = 'HIDDEN';
    fname.name = 'fname';
    lname.name = 'lname';

    var tokens = nameBox.value.split(' ');

    // Note there are a million ways to break this parser, demonstration only
    fname.value = tokens[0];
    lname.value = tokens[1];

    yourForm.appendChild(fname);
    yourForm.appendChild(lname);
}
```
```