Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP Forms
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms 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
 
Old April 21st, 2004, 05:29 AM
rok rok is offline
Registered User
 
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rok
Default not able to save data using javascript with asp

hi,

i created an asp page that stores and retrieve data from sql database. the thing is that there is a floating menu(created using javascript) in the page that performs the functions such as edit, save etc....the prblm is tht i am not able to save the data using the floating menu(even document.form1.submit didnt work) but is able to save it using the menus available on the page..pls help..:(..the floating menu code is as below:-
<script language=javascript>

if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')
</script>

<layer id="divStayTopLeft">

<table border="1" width="130" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="black">
<p align="center"><b>Menu</b></td>
</tr>
<tr>
<td width="100%" bgcolor="beige">
<p align="center">
<a href="#" onclick="javascript:return add_onclick();"><b>Add</b></a><br>
<a href="javascript:document.form1.submit();" onclick="javascript:savelk();"><b>Save</b></a><br>
<a href="#" onclick="javascript:edit_onclick();"><b>Edit</b></a><br>
<a href="javascript:document.location.replace('../academicmodule/masters.asp')"><b>Close</b></a><br>
<a href="#" onclick="javascript:saveall_onclick();"><b>Save All Classes</b></a></td>

</
</table>

</layer>


<script type="text/javascript">

var verticalpos="frombottom"

if (!document.layers)
document.write('</div>')

function JSFX_FloatTopDiv()
{
var startX = 650,
startY = 400;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id)
{
var

el=d.getElementById?d.getElementById(id):d.all?d.a ll[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x;this.style.t op=y;};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop +

document.body.clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function()
{
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : document.body.scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
}
else{
var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop +

document.body.clientHeight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("divStayTopLeft");
stayTopLeft();
}
JSFX_FloatTopDiv();
</script>






rgds,
rok
 
Old April 21st, 2004, 05:50 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Can you define "not able to save the data"? Do you get an error? If so, what error?
How is your form called? Does the form live in the same page?
How is the form named?

Side note: You may want to take a look here http://www.gazingus.org/html/Proper_...-protocol.html to find out why you shouldn't use the "statement label" JavaScript: in the onclick handlers of your <a> elements.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Finale (Allegro energico) by Mendelssohn & Bruch (Track 6 from the album: Violinkonzerte - Hoelscher)

 
Old April 22nd, 2004, 04:33 AM
rok rok is offline
Registered User
 
Join Date: Apr 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rok
Default

thanx imar for ur reply. but i have cracked it ..istead of links i placed buttons on the layer(floating menu) and now its working..the prblm tht i was facing was that the code for saving the data from the form to the database was written in vb script..and the floating menu was creatd in javascript..so i was not able to call the vbscript function for saving the data..also was not able to save the data with javascript alone.so now with the help of buttons i was able call the vbscript function..the correct code is given below..this is working but if u find any flaw do give a reply and yes thanx for ur guidance on the statement label thing.i have read the thing and will definitly use it properly in future.

<script language=javascript>
if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')
</script>

<layer id="divStayTopLeft">

<table border="1" width="130" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="black">
<p align="center"><b>Menu</b></td>
</tr>
<tr>
<td width="100%" bgcolor="beige">
<p align="center">
<INPUT name=jsadd <%=addbutton%> type=submit value=ADD <%=Session("disabledadd")%> LANGUAGE=javascript onclick="return jsadd_onclick()">
<INPUT name=jssave <%=jssavebutton%> type=submit <%=Session("disabledjsSave")%> value=SAVE LANGUAGE=javascript onclick="return jssave_onclick()">
<INPUT name=jsedit <%=jseditbutton%> type=button <%=Session("disabledjsEdit")%> value=EDIT LANGUAGE=javascript onclick="return jsedit_onclick()">
<input name=close type=button value=CLOSE LANGUAGE=javascript onclick="document.location.replace('../academicmodule/masters.asp')">
<input name=jssaveall <%=jssaveall%> type=submit <%=Session("disabledjsSaveAll")%> value="SAVE FOR ALL CLASSES" LANGUAGE=javascript onclick="return jssaveall_onclick()">
</td>

</tr>
</table>

</layer>


<script type="text/javascript">

var verticalpos="frombottom"

if (!document.layers)
document.write('</div>')

function JSFX_FloatTopDiv()
{
var startX = 520;
startY = 400;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id)
{
var el=d.getElementById?d.getElementById(id):d.all?d.a ll[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x;this.style.t op=y;};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop +

document.body.clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function()
{
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : document.body.scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
}
else{
var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop +

document.body.clientHeight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("divStayTopLeft");
stayTopLeft();
}
JSFX_FloatTopDiv();
</script>



rgds,
rok





Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript-Plz save my soul. Magxtopher ASP.NET 1.0 and 1.1 Basics 9 November 8th, 2008 03:21 AM
capturing asp data in clientside javascript Terry Joseph Migliorino Javascript How-To 9 November 2nd, 2005 09:10 AM
capturing asp data in clientside javascript Terry Joseph Migliorino Javascript 1 October 31st, 2005 01:42 PM
passing data btwn asp page and javascript include Justine Classic ASP Professional 8 August 20th, 2004 02:23 AM
not able to save data using javascript rok Classic ASP Databases 0 April 21st, 2004 04:31 AM





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