0
Explorer
,
/t5/coldfusion-discussions/checking-javascript-and-isdefined-tab/td-p/899867
Nov 17, 2008
Nov 17, 2008
Copy link to clipboard
Copied
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
<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
TOPICS
Getting started
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Explorer
,
Nov 18, 2008
Nov 18, 2008
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
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
LEGEND
,
/t5/coldfusion-discussions/checking-javascript-and-isdefined-tab/m-p/899868#M82681
Nov 17, 2008
Nov 17, 2008
Copy link to clipboard
Copied
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/checking-javascript-and-isdefined-tab/m-p/899869#M82682
Nov 17, 2008
Nov 17, 2008
Copy link to clipboard
Copied
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.
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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
philliptackett
AUTHOR
Explorer
,
/t5/coldfusion-discussions/checking-javascript-and-isdefined-tab/m-p/899870#M82683
Nov 18, 2008
Nov 18, 2008
Copy link to clipboard
Copied
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
Thanks in advance for all input,
Phil
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/checking-javascript-and-isdefined-tab/m-p/899871#M82684
Nov 18, 2008
Nov 18, 2008
Copy link to clipboard
Copied
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.
> 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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/checking-javascript-and-isdefined-tab/m-p/899872#M82685
Nov 18, 2008
Nov 18, 2008
Copy link to clipboard
Copied
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.
> 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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/coldfusion-discussions/checking-javascript-and-isdefined-tab/m-p/899873#M82686
Nov 18, 2008
Nov 18, 2008
Copy link to clipboard
Copied
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/checking-javascript-and-isdefined-tab/m-p/899874#M82687
Nov 18, 2008
Nov 18, 2008
Copy link to clipboard
Copied
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.
with a request.
Exactly what is required to communicate between a client and a server
via http.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
LATEST
/t5/coldfusion-discussions/checking-javascript-and-isdefined-tab/m-p/899875#M82688
Nov 18, 2008
Nov 18, 2008
Copy link to clipboard
Copied
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.
> 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.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

