Skip to main content
Participant
June 22, 2012
Answered

CF10 getPageContext().getRequest().getParameter("param")

  • June 22, 2012
  • 1 reply
  • 2582 views

Is there a setting within CF10 CFAdmin that allows me to get to the getPageContext().getRequest().getParameter("param")?

In CF10:

<form name="test" method="post">

    <input type="text" name="username" value="user.name" >

    <input type="submit" name="submit" value="submit" >

</form>

 

<cfdump var="#GetPageContext().getRequest().getParameter('username')#" />

the 'cfdump' displays undefined when form is submitted.

In CF9, the same piece of code, the 'cfdump' displays the value for 'username' which is 'user.name'.

This topic has been closed for replies.
Correct answer Adam Cameron.

This looks like a bug to me.  I note also that the getParameterMap() method does not work in CF10 either.

I'd raise a bug if I was you: https://bugbase.adobe.com/

If you post the bug ref back here, I'll vote for it.

That said, what are you trying to achieve here, for the purposes of trying to come up with a work around?  How come you're not simply using the FORM scope?

--

Adam

1 reply

Adam Cameron.Correct answer
Inspiring
June 26, 2012

This looks like a bug to me.  I note also that the getParameterMap() method does not work in CF10 either.

I'd raise a bug if I was you: https://bugbase.adobe.com/

If you post the bug ref back here, I'll vote for it.

That said, what are you trying to achieve here, for the purposes of trying to come up with a work around?  How come you're not simply using the FORM scope?

--

Adam

clever71Author
Participant
June 26, 2012

Thanks for replying Adam.

I have created a bug report https://bugbase.adobe.com/index.cfm?event=bug&id=3222889.

I come from a JSP environment and use to retrieving my parameters through the request.getParameter() method.

Far as using the FORM scope, this problem was found during my onRequest call in the Application.cfc and wanted to stay away from accessing the FORM scope directly within a CFC.

Chuck

Inspiring
June 26, 2012

Far as using the FORM scope, this problem was found during my onRequest call in the Application.cfc and wanted to stay away from accessing the FORM scope directly within a CFC.

I know what you mean in the usual sequence of events, but in the case of Application.cfc and specifically onRequest(), that method is entirely about wrangling the HTTP request, and form / URL / CGI handling are very much part of that.

Don't forget that the reason behind not using external scopes in a CFC is to not break encapsulation, but in this case I don't think there's much of an encapsulation issue to deal with.  Application.cfc is not a class in the normal sense of CFCs in CF, it's basically a bunch of event handlers and some inline code.

I think in this case slavishly adhering to rules is counterproductive, and really not in conflict with the spirit of the rule.

If you liked, you could farm the processing logic out to a separate method (perhaps in a different CFC) which onRequest() simply references the form scope directly so as to pass a reference to it to the method which does the work, which in turn is completely encapsulated and just works on "a passed-in structure" not specifically the form scope.

--

Adam