I need to take a user-entered value from a form-field and append it as a URL parameter when the user hits {ENTER} or clicks the submit button. I'm new to DreamWeaver CS5, and I have a project that I'm getting pressure to complete.
Additionally, if the OP has control of the action page, they could use structAppend() to add the contents of the form scope to the url scope.
Ben Doom
2010-09-30 12:50:10
Good point. I'll amend my answer.
Al Everett
2010-09-30 13:02:10
+1
A:
Like @Al Everett said,
Only need to change method = "get" instead of "post" in form attribute.
ppshein
2010-09-30 03:58:57
A:
Your simple HTML code should look like:
<html>
<head></head>
<body>
<cfif structKeyExists(form,"submit")> <!--- To ckeck if form is submiited --->
<cfoutput>Value = #url.mytextbox#</cfoutput>
</cfif>
<form name="myform" method="get" action=""> <!--- action is blank to submit on same page --->
<input type="text" name="mytextbox" />
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
Vikas
2010-09-30 04:00:27
"submit" won't exist in the FORM scope if you've used action="get". It'll also be in the URL scope.
Al Everett
2010-09-30 13:05:29