I have 2 major issues currently with javascript.
1. Doesnt anybody do any server side javascript anymore. I cant find
anything on the net about it. My major issue is with database connections
and queries. How do I set up a connection and send a quiery. any how-tos,
links, sample code, advice whatever.
2. i fave a form that is dynamicly creating elements and I am trying to
pass it to a server side script. How do I do this. The number of elements
will be different everytime. 1 field will be the same every time and that
will be the number of elements I am passing. so the url will look
something like this
a.html?number="+ number +"&element0="+ document.forms[0].elements
[0].value
or
a.html?number="+ number +"&element0="+ document.forms[0].elements
[0].value +"&element1="+ document.forms[0].elements[1].value
etc.
3. this.location.replace(send); I am trying to use this as a redirect,
why doesnt it work? I call it when the submit button on the form is hit
and the form figures out which elements have been chosen. any ideas 4 2208
In article <Xn**********************************@216.65.98.9> , wenjoh26
@emNOSPAMail enlightened us with... I have 2 major issues currently with javascript.
1. Doesnt anybody do any server side javascript anymore. I cant find anything on the net about it. My major issue is with database connections and queries. How do I set up a connection and send a quiery. any how-tos, links, sample code, advice whatever.
Sure, but it's most common as JScript with ASP.
The syntax is a little different, IIRC, from Netscape's server-side
javascript. Someone correct me if I'm wrong.
If you're using ASP, search for JScript instead of javascript for links
(Google).
2. i fave a form that is dynamicly creating elements and I am trying to pass it to a server side script. How do I do this.
The same way you always do. With GET or POST.
If you're "passing" it to a server-side script via the URL, simply
submit using GET instead of POST and you don't have to build a URL.
If for some odd reason you feel the need to replace, as you imply below,
loop through the form element array and build the url.
e = document.myFormName.elements;
l = e.length;
for (i=0; i<l; i++)
{
// e[i] is a form element with name and value - do something with
it
}
3. this.location.replace(send); I am trying to use this as a redirect, why doesnt it work? I call it when the submit button on the form is hit and the form figures out which elements have been chosen. any ideas
What doesn't it do that you think it should? "it doesnt work" is about
as descriptive as calling up your mechanic and telling him your car is
broken.
-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich. http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
kaeli <in********************@NOSPAMatt.net> wrote in
news:MP************************@nntp.lucent.com: In article <Xn**********************************@216.65.98.9> , wenjoh26 @emNOSPAMail enlightened us with... I have 2 major issues currently with javascript.
1. Doesnt anybody do any server side javascript anymore. I cant find anything on the net about it. My major issue is with database connections and queries. How do I set up a connection and send a quiery. any how-tos, links, sample code, advice whatever.
Sure, but it's most common as JScript with ASP. The syntax is a little different, IIRC, from Netscape's server-side javascript. Someone correct me if I'm wrong. If you're using ASP, search for JScript instead of javascript for links (Google).
Jscript is the exact same thing as javascript except that it is produced
by microsoft. You know how it goes microsoft is to cheap to licence
anything so they make there own shitty version (which nobody uses because
of vb (which is another crappy language)). In then end microsoft realizes
that its language is no good then pays the licensing fee's. You can do
javascript with a runat="server" in the script heading and it does run on
iis. Im not even sure microsoft supports jscript anymore. 2. i fave a form that is dynamicly creating elements and I am trying to pass it to a server side script. How do I do this. The same way you always do. With GET or POST.
If you're "passing" it to a server-side script via the URL, simply submit using GET instead of POST and you don't have to build a URL.
If for some odd reason you feel the need to replace, as you imply below, loop through the form element array and build the url. e = document.myFormName.elements; l = e.length; for (i=0; i<l; i++) { // e[i] is a form element with name and value - do something with it }
the reason I am replacing the url is because I am building a survay which
has about 300 elements. If the user chooses a radio button, the
information on that section is needed. If the user does not, then I do
not. So I was hoping to cut down on bandwidth use by only sending the
needed information instead of all 300+ elements. Now by what you are
saying if I recreat the url and pass it, I can get the information by
reading it like it was a form. So if I do not have a form on my page and
I pass 7 elements I can get the information with a document.forms
[0].elements[0].value. am I correct on this?
3. this.location.replace(send); I am trying to use this as a redirect, why doesnt it work? I call it when the submit button on the form is hit and the form figures out which elements have been chosen. any ideas
What doesn't it do that you think it should? "it doesnt work" is about as descriptive as calling up your mechanic and telling him your car is broken.
Well basicaly it doesnt do the redirect. I hit submit and it seems to
pass over this line and just reload the page sending all of the elements.
Is there issues with submit that makes it have to reload or can I break
out of the form reload and redirect to where I want to go. Would it be a
better idea to lose this this.location.replace(send); and change the form
to say document.write("action=\""+ send +"\""); ------------------------------------------------- ~kaeli~ Jesus saves, Allah protects, and Cthulhu thinks you'd make a nice sandwich. http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace -------------------------------------------------
john <wenjoh26@em*********@pct.edu> writes: Jscript is the exact same thing as javascript except that it is produced by microsoft.
Not correct. JScript is an implementation of ECMAScript for browsers,
just like Javascript
You know how it goes microsoft is to cheap to licence anything so they make there own shitty version (which nobody uses because of vb (which is another crappy language)).
Which is it? Jscript is the same as Javascript (which means that
plenty of people use it) or nobody uses it?
In then end microsoft realizes that its language is no good then pays the licensing fee's.
There is no licensing fee on Javascript/ECMAScript. Are you thinking
of Microsoft's Java implementation? Your story sounds more like it.
You can do javascript with a runat="server" in the script heading and it does run on iis.
It runs in ASP, which typically runs on an IIS.
Im not even sure microsoft supports jscript anymore.
They definitly do. The newest version of JScript implements the
working draft of ECMA 262 version 4, which adds things like classes
and type declarations to ECMAScript. It is compiled to .net, and can
therefore be used in ASP.net.
So if I do not have a form on my page and I pass 7 elements I can get the information with a document.forms [0].elements[0].value. am I correct on this?
if "document.forms[0].elements[0]" is something that is executed on
the server, then probably. If there are no forms on the client, then
"document.forms" is empty.
Well basicaly it doesnt do the redirect. I hit submit and it seems to pass over this line and just reload the page sending all of the elements.
Where is "this.location.replace(...)" called? Are you sure "this" refers
to the global/window object?
Try adding "return false" to the onsubmit handler (I assume it is called
from one).
Is there issues with submit that makes it have to reload or can I break out of the form reload and redirect to where I want to go.
Generally, to prevent an action, you return false from the action event
handler.
Would it be a better idea to lose this this.location.replace(send); and change the form to say document.write("action=\""+ send +"\"");
Most likely not. That would give you an almost empty document containing:
action=" ...value of send... "
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
And on the day 10 Oct 2003 21:16:17 -0500, wenjoh26@emNOSPAMail
enlightened us with <Xns9410E256D9D70wenjoh26emNOSPAMailp@
216.65.98.9>... Jscript is the exact same thing as javascript except that it is produced by microsoft. You know how it goes microsoft is to cheap to licence anything so they make there own shitty version (which nobody uses because of vb (which is another crappy language)). In then end microsoft realizes that its language is no good then pays the licensing fee's. You can do javascript with a runat="server" in the script heading and it does run on iis. Im not even sure microsoft supports jscript anymore.
No it isn't the same and when you want to find out how to do something
with it, a search for jscript will bring up a LOT more (useful) results
than server-side javascript.
Just because runat=server works in IIS doesn't mean people use it. They
use language=jscript at the top or <script language=jscript> and write
the script in jscript. So, searching for jscript will be much more
useful for you.
the reason I am replacing the url is because I am building a survay which has about 300 elements. If the user chooses a radio button, the information on that section is needed. If the user does not, then I do not. So I was hoping to cut down on bandwidth use by only sending the needed information instead of all 300+ elements.
It's just text in the URL. I was unaware that affected bandwidth all
that much. Have you done any testing? I'd love to know the results. My
apps are all for intranet apps that run on a T1, so it'd be useful for
me to know in case I ever do an internet application.
Now by what you are saying if I recreat the url and pass it, I can get the information by reading it like it was a form.
SERVER-SIDE.
If you do it client-side with javascript, you'd need to parse the URL.
So if I do not have a form on my page and I pass 7 elements I can get the information with a document.forms [0].elements[0].value. am I correct on this?
No.
If you had a radio button called myRadio...
myVar = Request.Form("myRadio")
(That's vbscript - check your language of choice for forms processing on
the server. It may be the same in jscript.)
document.forms is client-side AFAIK and is not defined if you don't have
a form.
You would build the URL client-side using document.forms, but you must
have a form.
Well basicaly it doesnt do the redirect. I hit submit and it seems to pass over this line and just reload the page sending all of the elements.
A form with no action defined sends to the same page (so it looks like
it's refreshing). So...
<form name="f1" onSubmit="whatever();return false;">
(replace the whatever function with yours)
Return false stops the submission to itself.
--------------------------------------------------
~kaeli~
Kill one man and you are a murderer. Kill millions
and you are a conqueror. Kill everyone and you
are God. http://www.ipwebdesign.net/wildAtHeart/ http://www.ipwebdesign.net/kaelisSpace/
------------------------------------------------ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
| |