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

Application Scope

Participant ,
Mar 24, 2009 Mar 24, 2009

Copy link to clipboard

Copied

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

Views

534

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied


Thanks Ian!

Any short example of code structure I should follow?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Dan, you just made a good point!

I better start thinking about some solutions :-)

Thanks Dan and Ian!

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST
SESSION scope seems more appropriate for your case.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/

Votes

Translate

Translate

Report

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
Documentation