![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
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 |
| Sponsored Links |
|
|||
|
|
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
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. |
|
|||
|
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 |
|
|||
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise