• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 128
  • Last Modified:

What would this ColdFution Function means


I am new to ColdFusion and trying to understand this line:
document.requestForm.action='index.cfm?requesttype=' + sh + '&ResetForm=' + ResetFrm;

1) What would the whole line mean?
2) what does the & added to the variable &ResetForm?

Thank you,

function chForm(sh, ResetFrm) 
	if (ResetFrm == 'y') 
			document.requestForm.action='index.cfm?requesttype=' + sh + '&ResetForm=' + ResetFrm;
			return true;		

Open in new window

2 Solutions
This looks like javascript to me....  that line is setting the form action="index.cfm?requesttype=sh&ResetForm=ResetFRM"  where sh and ResetFfrm are replaced with the values passed into the function.
(no points)

Agreed, that is not Coldfusion, it is javascript and deos as rjohnson says; it assigns that URL and query string to the form's action.
Rad1Author Commented:
what does the & added to the variable &ResetForm? means?


Does the below line means Document take action on the index.cfm and the query string ?
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

käµfm³d 👽Commented:
ResetForm isn't the variable--ResetFrm is. This code is just a string concatenation operation. The ampersand is a part of the querystring, and it is used to separate each key/value pair from the others. Each key/value (aside from the first) will have an ampersand in front of it.
This (requestForm) is the name of your form, so this...


Means that form's action tag as in... <FORM ACTION="xxxx" METHOD="POST">

So, this javascript.. is assigning the action so that when the form posts, it will post to index.cfm.

The parameters of index.cfm are delimted by ? and &  just like on any normal URL.   Look at the URL and you can see the variables.  After the file is always a ? and then between the parameter=value pair you have & separators

SO, the javascript is passing the variable  "requesttype"   and the variable "ResetForm" to index.cfm
If you look into index.cfm you should see these variables.

The value the javascript is giving these two variables is determined by the function calll here:  
function chForm(sh, ResetFrm) .    If you look on the page for a call to   chForm(xxx, yyyy) those are the two values that are being passed to those two variables.   Whatever Xxxx is and yyyy will be put into requesttype and ResetForm respectively.

So, the short version is... look on the page for  this function call:   chForm(xxx, yyyy)   and then go to index.cfm and you will see   url.requesttype getting the value of xxx and url.ResetForm getting the value from yyyy
Rad1Author Commented:
Yes, yes, thank you!!!!

That is very true and correct, I think I missed it because of me think of ColdFusion.  
My Bad!!!!

Thank you for the great explanations.


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now