Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 13th, 2004, 01:31 PM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , .
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default Javascript variable values into ASP

This sound like an easy question, but it prove more difficult than I thought.

I have some variables in JavaScript. What I want to do is grab the values from these JavaScript variables and put(assign) them into ASP VBScript variable. How would I do that? Below I have two JavaScript variables.

var FirstVal = document.form1.selList1.options.value;
var FirstValIndex = document.form1.selList1.selectedIndex;

Thank you.

Leon

  #2 (permalink)  
Old May 13th, 2004, 01:42 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

You could dynamically assign hidden field values to variable values and then have JavaScript submit the form.

HTH,

Snib

<><
  #3 (permalink)  
Old May 13th, 2004, 02:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

You can't assign JavaScript variables to ASP variables, because of the client/server difference. You have to use another way like the hidden field like Snib's or redesign the form to post back every time the user makes a change (complete server-based approach).

Brian


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing ASP variable from Javascript sasidhar79 Classic ASP Basics 2 March 8th, 2017 05:31 PM
storing Javascript variable to ASP variable rupen Classic ASP Basics 5 April 10th, 2007 07:06 AM
assign javascript variable to asp variable manjunath_c_k Classic ASP Basics 1 September 14th, 2006 07:35 AM
ASP variable inside my JavaScript crmpicco Javascript How-To 1 June 4th, 2005 12:17 AM
set ASP variable values inside Javascript crmpicco HTML Code Clinic 1 March 9th, 2005 12:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.