Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Application Scope

Participant ,
Mar 24, 2009 Mar 24, 2009
Hi Community!

How do I change the value of an application variable on the event onSubmit()?

I don't know if I can use javascript to modify application variables. I think I can't but I wanted to hear from the experts :-)

Thanks!

Ysais.
TOPICS
Advanced techniques
619
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2009 Mar 24, 2009
apocalipsis19 wrote:
> I don't know if I can use javascript to modify application variables. I think
> I can't but I wanted to hear from the experts :-)

Code running in a client (AKA JavaScript) can *NOT* change any values in
memory on the server or vice a versa.

If you want the client to communicate anything to the server it must use
some type of communication with it. The normal would be a HTTP request
either a normal get or post request or a JavaScript request object AKA AJAX.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 24, 2009 Mar 24, 2009

Thanks Ian!

Any short example of code structure I should follow?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2009 Mar 24, 2009
apocalipsis19 wrote:
> Thanks Ian!
>
> Any short example of code structure I should follow?

<form id="getRequestExample" action="thisPage.cfm" method="get">
<input type="hidden" name="placeMeInApplicationScope" value="foobar">
<input type="submit">
</form>

<cfif structKeyExists(url,"placeMeInApplicationScope")>
<cfset application.something = url.placeMeInapplicationScope>
</cfif>

If you want more, we would need to know more about what you want to do.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 24, 2009 Mar 24, 2009
Hi Ian!

I only to change a a value from application.valSetter = 1 to application.valSetter = 0.

I want to accomplish that on the submit event. I just want to determine if the user had already submitted that page in the last hour. Some values in the local scope disappear once the page is submitted.

THanks!

Ysais.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2009 Mar 24, 2009
Actually, all local variables disappear once a page has been submitted. Also, what do you want to do if another user had submitted that page in the last hour? What about if the user had submitted another page in the last hour?

The gist of all this is that application variables might not be the best way to accomplish your goal.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 24, 2009 Mar 24, 2009
Dan, you just made a good point!

I better start thinking about some solutions :-)

Thanks Dan and Ian!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 24, 2009 Mar 24, 2009
LATEST
SESSION scope seems more appropriate for your case.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources