BillHely
asked on
Form field concatenation
OVERVIEW:
Need to concatenate two form fields and pass the result with the form submission.
PSEUDOCODE EXAMPLE:
<FORM name="frm_Join" METHOD="POST" ACTION="http://www.aweber.com/scripts/newlead.pl">
<input type="text" name="custom txt_FirstName" id="firstname">
<input type="text" name="custom txt_LastName" id="lastname">
<SCRIPT LANGUAGE="JavaScript">
<!-- Start
function showFullName()
{
var jFirstName = document.getElementById("f
var jLastName = document.getElementById("l
var jFullName = jFirstName + " " + jLastName
document.frm_AffJoin.name.
}
// End -->
</SCRIPT>
<INPUT TYPE="HIDDEN" NAME="FullName" value="FirstName LastName">
</form>
SOLUTION REQUIRED:
For the hidden FullName field to pass a concatenation of FirstName+" "+LastName when the form is submitted.
CONDITIONS:
The name of the FirstName and LastName input fields has to be two words, starting with "custom". That is a requirement of the Perl target script. That's why I'm trying to use ID.
EXPLANATION:
My JavaScript is almost non-existent, but I have tried to reach a solution by concatenating the FirstName and LastName fields in javascript, and pass the jFullName variable to the hidden field, but I don't know how to do it and everything I have tried fails. I've cut down the code just to show clearly what I am trying to do.
Thanks in advance for any help.
- Bill H.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
that is anyway removed when the function is called
document.frm_Join.FullName .value = jFullName
but yes you can remove it
document.frm_Join.FullName
but yes you can remove it
ASKER
Thanks sajuks. That works fine.
- Bill H.
- Bill H.
ASKER
Thanks sajuks. I'll try your suggestion in the morning as I am about to go out.
However, I assume I should also remove the "value" term from:
<INPUT TYPE="HIDDEN" NAME="FullName" value="FirstName LastName">
so it reads:
<INPUT TYPE="HIDDEN" NAME="FullName">
- Bill H.