Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Combining ASP and Javascript
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Combining ASP and Javascript

 Post Reply Post Reply
Author
Epon View Drop Down
Newbie
Newbie


Joined: 20 October 2003
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Epon Quote  Post ReplyReply Direct Link To This Post Topic: Combining ASP and Javascript
    Posted: 28 October 2003 at 12:45am

Hi,

I'm having trouble with using a Javascript value in ASP. In my asp page I have a form:

<form name="form">

<input type="text" name="country">

<input type="submit" name="submit" onclick="return cmdSubmit_onclick()">

</form>

On top of my asp page I have a Javascript function link this:

function cmdSubmit_onclick() {

ctry = document.form.country.value

if (ctry!="")

{

<% strSQL = "SELECT Country FROM SC WHERE Country = " &ctry%>

}

}

My question is how do I use the value of ctry in ASP?

Really appreciate if someone could help me.

Thanks

Back to Top
3BEPb View Drop Down
Groupie
Groupie


Joined: 07 August 2003
Location: United States
Status: Offline
Points: 81
Post Options Post Options   Thanks (0) Thanks(0)   Quote 3BEPb Quote  Post ReplyReply Direct Link To This Post Posted: 28 October 2003 at 2:33am

No way, AFAIK. Javascripts executes on client, but vbscript in your case executes on server, i.e. before javascript. The only solutions is to load all countries from database and make javascript array out of them, and then select proper country by js from js array.

So, since ASP is executing vbscript first means you can dynamically build javascript out of asp (let's say database records), but tot vice versa.



Edited by 3BEPb
Back to Top
JoeP View Drop Down
Newbie
Newbie
Avatar

Joined: 10 October 2003
Location: United States
Status: Offline
Points: 38
Post Options Post Options   Thanks (0) Thanks(0)   Quote JoeP Quote  Post ReplyReply Direct Link To This Post Posted: 31 October 2003 at 2:34pm

can submit the form to the same page:

<form name="form" method=post action="thispage.asp>

Capture ctry in code:

ctry = request.form("ctry")

then perform sql action.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.