Shabam wrote:
I have a form page that accepts a text field variable. The problem is, I
need to concatenate this text field variable with some other string. How
can I get this done?
String concatenation is done through the overloaded + operator.
So, suppose a user enters "hello" in the text box. When he submits the form
I need the form variable DOMAINURL to be "hello.whatever.com" in the GET
url. Will this require javascript or no? If so, what do I need? Thanks.
Suppose you have a form like so:
<form action = "url" method = "get" onsubmit = "return
myFormHandler(this)">
....
<input type = "text" name = "myTextBox"/>
<input type = "hidden" name = "DOMAINURL"/>
....
</form>
Then in the javascript you can do something like the following:
function myFormHandler(myForm)
{
if(myForm.elements["myTextBox"].value != "")
{
myForm.elements["DOMAINURL"].value =
myForm.elements["myTextBox"].value + ".url.com";
return true;
}
return false;
}
Hope this helps :)