Adobe Dreamweaver Forums



Last 10 THreads :         Charts: Gap between Vertical Axis and the chart area (Last Post : flexisawesome - Replies : 1 - Views : 2 )           »          Dragging components (Last Post : hsfrey - Replies : 4 - Views : 5 )           »          Pop up window using AS3 (Last Post : retsnomrev - Replies : 3 - Views : 4 )           »          can a combobox contain two different list seperated byvdivider ? (Last Post : v-Jay - Replies : 2 - Views : 6 )           »          Refreshing xml data in flex (Last Post : PiyushGiri01 - Replies : 2 - Views : 19 )           »          Integrating Captivate with ASP - SQL? (Last Post : bikturisint - Replies : 19 - Views : 131 )           »          Re: IPhone (Last Post : MiLSaN99 - Replies : 0 - Views : 1 )           »          Re: IPhone (Last Post : MiLSaN99 - Replies : 0 - Views : 1 )           »          Re: IPhone (Last Post : MiLSaN99 - Replies : 0 - Views : 1 )           »          Re: IPhone (Last Post : MiLSaN99 - Replies : 0 - Views : 1 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Macromedia Software > Cold Fusion > Getting Started
 
Tags:



Reply
  #1 (permalink)  
Old 11-17-2008, 10:44 PM
philliptackett
 
Posts: n/a
Diggs:
Default checking javascript and Isdefined tab

I would like to have some client side javascript validate first then run a SQL
stored procedure next, but only IF the javascript evaluates to true. Currenly,
I have some code like:


<cfif IsDefined("Form.submit")>
run stored procedure
<cfelse>
show form
</cfif>

What's happening is my java is firing, but then the form runs the SP and I
don't want that to occur UNLESS the java evaluates to true. I was just
wondering if this is something syntactically I should do in the cold fusion
side or in the javascript side?

Thanks,
Phil



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-17-2008, 10:54 PM
Azadi
 
Posts: n/a
Diggs:
Default Re: checking javascript and Isdefined tab

on js side.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Reply With Quote
  #3 (permalink)  
Old 11-17-2008, 11:03 PM
Ian Skinner
 
Posts: n/a
Diggs:
Default Re: checking javascript and Isdefined tab

I'm not sure how you are trying to do this, but it sounds like a classic
misunderstanding of how ColdFusion and JavaScript work together, in so
much as they *don't*. ColdFusion runs on the server and JavaScript runs
on the client and never do the two meet!

You can have ColdFusion deliver dynamic JavaScript to the client, the
same as it can deliver dynamic HTML.

You can have JavaScript make HTTP requests to ColdFusion resources.
With AJAX techniques you can even do this behind the scenes without
refreshing the browser.

But you can not have ColdFusion and JavaScript running together in any
truly, line by line, coordinated manner.

Reply With Quote


  #4 (permalink)  
Old 11-18-2008, 05:14 PM
philliptackett
 
Posts: n/a
Diggs:
Default Re: checking javascript and Isdefined tab

Is it possible to read a variable from Javascript in Cold Fusion? There's got
to be a way to do what I'm trying to do. It's really fundamental. I want
javascript to validate the form and I want to check if the form is
submitted/validated in Cold Fusion before proceeding. Does any1 have any
suggestions?

Thanks in advance for all input,
Phil

Reply With Quote
  #5 (permalink)  
Old 11-18-2008, 05:24 PM
Ian Skinner
 
Posts: n/a
Diggs:
Default Re: checking javascript and Isdefined tab

philliptackett wrote:
> Is it possible to read a variable from Javascript in Cold Fusion? There's got
> to be a way to do what I'm trying to do. It's really fundamental.


No it is not possible! Javascript is running on a client, ColdFusion is
running on a server. You are asking is it possible for one system, that
could be thousands of miles away, to read something in memory on another
system.

What is possible is to *send* a variable from the client to the server
in a normal HTTP request. Javascript has plenty of ways to do this. It
uses any of the normal http methods to send data between systems;
get(URL), post(FORM) or cookies - take your choice.

To make it look more like these two separate systems are 'one', it is
possible to make this HTTP request behind the scenes using asynchronous
requests, commonly called AJAX.
Reply With Quote
  #6 (permalink)  
Old 11-18-2008, 07:53 PM
Ian Skinner
 
Posts: n/a
Diggs:
Default Re: checking javascript and Isdefined tab

philliptackett wrote:
> Is it possible to read a variable from Javascript in Cold Fusion? There's got
> to be a way to do what I'm trying to do. It's really fundamental.


No it is not possible! Javascript is running on a client, ColdFusion is
running on a server. You are asking is it possible for one system, that
could be thousands of miles away, to read something in memory on another
system.

What is possible is to *send* a variable from the client to the server
in a normal HTTP request. Javascript has plenty of ways to do this. It
uses any of the normal http methods to send data between systems;
get(URL), post(FORM) or cookies - take your choice.

To make it look more like these two separate systems are 'one', it is
possible to make this HTTP request behind the scenes using asynchronous
requests, commonly called AJAX.
Reply With Quote


  #7 (permalink)  
Old 11-18-2008, 10:14 PM
philliptackett
 
Posts: n/a
Diggs:
Default Re: checking javascript and Isdefined tab

I was able to get this to work. What I did was set a value in javascript of the
submit button like this

document.Register.submit.value = "No"

I did this in the validation function of the javascript. Then I was able to
read the value from cold fusion like this
<cfif #form.submit# NEQ "No" >

So I appreciate the attempts for help, but I got it.
Phil

Reply With Quote
  #8 (permalink)  
Old 11-18-2008, 10:14 PM
Ian Skinner
 
Posts: n/a
Diggs:
Default Re: checking javascript and Isdefined tab

There you go, you used JavaScript to set a post value that was submitted
with a request.

Exactly what is required to communicate between a client and a server
via http.
Reply With Quote
  #9 (permalink)  
Old 11-18-2008, 10:14 PM
Ian Skinner
 
Posts: n/a
Diggs:
Default Re: checking javascript and Isdefined tab

philliptackett wrote:
> document.Register.submit.value = "No"

....
> <cfif #form.submit# NEQ "No" >
>


I presume you are *NOT* relying on that value as your sole
validation.

JavaScript is great for user interface validation. But if you are
counting on it on the server to ensure the safety of your application
and|or data you are asking for trouble.

It is incredibably easy to turn-off|modify JavaScript in a browser and
completely bypass|subvert your validation.

Just saying that the prudent developer validates *all* data
received from a client at the server. Never trust what may or may not
have happened on the client.
Reply With Quote


Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 07:34 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk