473,508 Members | 2,040 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing form elements from page to page

My code works but because I'm using VBscript within JavaScript I get an error
message...the yellow tri-angle with an "!" mark.

---------------within my body-------------
<script language="JavaScript">document.write(formatCurrenc y(<%=Request.Form
("total")%>))</script>
------------------------------------------
My script takes the form element "total" from the previous page and sends it
to a function for formatting. Problem is...JavaScrip just doesn't like
VBscript. How do I get the form element using JavaScript?
Jul 23 '05 #1
3 3512
In article <ui***************************@news.ks.uiuc.edu> , abbylee26
@hotmail.com enlightened us with...
My code works but because I'm using VBscript within JavaScript
Not because.
Javascript can call client-side vbscript just fine, if it's done right and IE
is the browser. See code below.

---------------within my body-------------
<script language="JavaScript">document.write(formatCurrenc y(<%=Request.Form
("total")%>))</script>
------------------------------------------
My script takes the form element "total" from the previous page and sends it
to a function for formatting. Problem is...JavaScrip just doesn't like
VBscript. How do I get the form element using JavaScript?


You don't. It has nothing to do with getting the form element. The form
element is gotten via ASP server-side VBscript. You are calling this function
as though it is client-side.

Is formatCurrency a client-side vbscript function you wrote? If not, this is
the wrong syntax to use (it needs to be in the <%= %> construct as well). If
so, check that it returns a string, as expected by document.write.

If it is a server-side function (one defined in your ASP), do this: (note the
quotes! they are important.)

document.write("<%= formatCurrency(Request.Form ("total") %>")

If it is a client-side function:
Client-side example (IE ONLY):
This works fine in IE. So, it's something you're doing wrong.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title> New Document </title>
<script type="text/vbscript">
Function sayHi (str)
sayHi = "Hi!" & str
End Function
</script>
</head>

<body>
<script type="text/javascript">
document.write(sayHi("Whee!"));
</script>
</body>
</html>

--
--
~kaeli~
Shotgun wedding: A case of wife or death.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
Abby Lee wrote:
My code works but because I'm using VBscript within JavaScript I get an error
message...the yellow tri-angle with an "!" mark.

---------------within my body-------------
<script language="JavaScript">document.write(formatCurrenc y(<%=Request.Form
("total")%>))</script>
------------------------------------------
My script takes the form element "total" from the previous page and sends it
to a function for formatting. Problem is...JavaScrip just doesn't like
VBscript. How do I get the form element using JavaScript?


Just in case you are client-side and still want to get the form value...

<body>
<p>The button can use 'this.form' because it belongs to the same form
as the text area it's trying to get the value of.</p>
<p>The link uses document.forms because it's external to the form - and
AFAIK <a> tags can't be children of forms.</p>

<form name="theForm" action="">
<input type="text" name="total" cols="20">
<input type="button" value="Show text"
onclick="alert('You entered: ' + this.form.total.value);">
<input type="reset">
</form>
<p><a href="#"
onclick="alert('You entered: '
+ document.forms['theForm'].elements['total'].value);">Show
text</a> using a link.</p>

</body>

Fred.
Jul 23 '05 #3
"Abby Lee" <ab*******@hotmail.com> wrote in message
news:ui***************************@news.ks.uiuc.ed u...
My code works but because I'm using VBscript within JavaScript I get an error message...the yellow tri-angle with an "!" mark.

---------------within my body-------------
<script language="JavaScript">document.write(formatCurrenc y(<%=Request.Form ("total")%>))</script>
------------------------------------------
My script takes the form element "total" from the previous page and sends it to a function for formatting. Problem is...JavaScrip just doesn't like
VBscript. How do I get the form element using JavaScript?

This works for me (on an IE browser).

<html>
<head>
<title>jsandvbs.ht</title>
<script type="text/vbscript">
Function Money(amount)
Money = FormatCurrency(amount)
End Function
</script>
</head>
<body>
<script type="text/javascript">
var money = Money(1234.56);
document.write(money);
</script>
</body>
</html>
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3622
by: Jason | last post by:
Hi folks, I'm trying to create a section of a website with a unique file upload utility. The problem is that in most code and components I find to pass multipart/form data, you need to know the...
12
6509
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
1
4581
by: Kevin Lyons | last post by:
Hello, I am trying to get all of my form elements passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html to the following URL:...
11
41173
by: HolaGoogle | last post by:
Hi, Sorrryy to ask such basic question but i do need your help! Here's what i'm trying to do: In my parent form i'm calling a my Iframe form to get certain value, then depending on that value...
2
2512
by: Richard | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** HI, I am working on a project where I need to input data to a (local) HTML page using multiple form elements, such as text,...
9
2147
by: Max | last post by:
I'm new with Javascript and can't seem to figure out what I'm doing wrong here as I'm not able to pass a simple variable to a function. In the head of doc I have: <script...
5
2109
by: Rod | last post by:
I've written 2 ASP.NET applications (I've worked on one with a team and another by myself). In my ASP.NET pages, when saving data to a backend database I've done it by using the click event of a...
1
2259
by: williamroy | last post by:
Hello, I've got a form that runs over 5 pages. I need the last page submit button to post all of the answers at one time from the previous 5 pages (to another server). I'd like to see the last...
1
11847
by: | last post by:
Hi, 1st, I did a search and could not find any info on this, the Google results were good, but I'm still have issues...So any help will be great. I have a frame page, which contains 3 frames...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.