Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Refresh method


Message #1 by arshad siddiqui <ash_arshad@y...> on Mon, 4 Mar 2002 01:07:16 -0800 (PST)
Hi,



The given below script is working perfectly alright if

only drop downs are there but this one is not working

as I have added some text boxes also.Here I am using

dynamic drop down these two drop downs are database

dependent.I have added a javascript so that the the

page refreshes when we change something in first drop

down.but here when I select something from the first

drodown then also same after refreshing same thing

comes in first dropdown and in second dropdown also

same things related to first dropdown are coming.



Please help



Thanks



Here goes the script:

------------------------------------



<%@ Language=VBScript%>

<!-- #INCLUDE VIRTUAL FILE="adovbs.inc" -->

<HTML><HEAD>

<title>Upload Products</title>

<script language=javascript>

function subItem1()

{

document.frmTest.action="UploadAccessory.asp";

document.frmTest.submit();

}

</script>

</head>

<BODY bgColor=white>

<P align=center><FONT style="FONT-FAMILY: verdana"

color="#880000" 

size=5><STRONG>Admin Page 

for Product Upload </STRONG>     </FONT></P>

<font color="black" ><STRONG><FONT size=2><FONT

color=black><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
amp;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&am
p;nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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ONT></FONT></STRONG>

 <A href="admin.asp?task=logout">

<font color="black" size=1

face=Verdana><STRONG>Logout</STRONG></font></A></font></B>

<P></P>

<p

align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

</p>

<form  METHOD="post"  enctype="multipart/form-data"

ACTION="category.asp" name="frmTest" >

</FONT>

<div align="center" style="width: 904; height: 400">

  <center>

  <%

'strconn = "Driver={SQL

Server};Description=sqldemo;SERVER=127.0.0.1;UID=LoginID;PWD=Password;DATABASE=Database_Name

set conn = server.createobject("adodb.connection")

'conn.open strconn

	conn.Open "DBQ=" & Server.Mappath("Ramy.mdb") &

";Driver={Microsoft Access Driver (*.mdb)};"



    'set objRS = createobject("ADODB.Recordset")

    sql="select CategoryID,CategoryName from Category"

    set objRS = conn.Execute (sql)

'objRS.Open "select ID, strParent from Parents",

strconn

    if Request("cboPrimary") = "" then

        lPrimary = objRS("CategoryID")

    else

        lPrimary = clng(Request("cboPrimary"))

    end if

%>

  <table border="0" cellpadding="0" cellspacing="0"

style="BORDER-COLLAPSE: collapse"

bordercolor="#111111" width="84%" id="AutoNumber1">

   

    

        <tr>

      <td width="35%"><b><font face="Verdana"

size="2">Select Category</font></b></td>

      <td width="65%"><select name=cboPrimary size=1

onChange="subItem1()">

<%while not objRS.EOF

lID = clng(objRS("CategoryID"))%>

<option value="<%=lID%>"<%if lPrimary = lID then

Response.Write "

SELECTED"%>><%=objRS("CategoryName")%>

<%    objRS.MoveNext

wend

objRS.Close

sql1="select SubCatID,SubCatName from SubCategory

where CatID="& lPrimary &""

set objRS = conn.Execute (sql1)

'objRS.Open "select ID, strChild from Children WHERE

intParent=" & lPrimary, strconn

%>

</select></td>

    </tr>

   

    

        <tr>

      <td width="35%"><b><font face="Verdana"

size="2">Select SubCategory</font></b></td>

      <td width="65%"><select name=cboSecondary

size=1">

<%while not objRS.EOF

lID = clng(objRS("SubCatID"))%>

<option value="<%=lID%>"

selected><%=objRS("SubCatName")%>

<%    objRS.MoveNext

wend

objRS.Close

'set objRS.ActiveConnection = nothing

set objRS = nothing

conn.Close 

set conn=nothing

%>

</select></td>

    </tr>

   

    

        <tr>

      <td width="35%"><b><font face="Verdana"

size="2">ProductID:</font></b></td>

      <td width="65%"><input name="ProductID"

size="20" 

     ></td>

    </tr>

    <tr>

      <td width="35%"><b><font size="2"

face="Verdana">Product Name:</font></b></td>

      <td width="65%"><input name=ProductName

size="20" 

     ></td>

    </tr>

    <tr>

      <td width="35%"><b><font face="Verdana"

size="2">Product Description(brief):</font></b></td>

      <td width="65%"><TEXTAREA name=BriefDesc rows=3

cols=60></TEXTAREA></td>

    </tr>

    <tr>

      <td width="35%"><b><font face="Verdana"

size="2">Product Image:</font></b></td>

      <td width="65%"><input type="file"

name="ATTACH1" size="40"></td>

    </tr>

    <tr>

      <td width="35%"><b><font face="Verdana"

size="2">Product Sale Price:</font></b></td>

      <td width="65%"><input name="SalePrice"

size="20"   ></td>

    </tr>

    <tr>

      <td width="35%"><b><font face="Verdana"

size="2">Product Stock Quantity:</font></b></td>

      <td width="65%"><input name="Quantity" size="20"

  ></td>

    </tr>

    <tr>

      <td width="35%"><b><font face="Verdana"

size="2">Product 

      Description(Detail):</font></b></td>

      <td width="65%"><TEXTAREA name="DetailDesc"

rows=5 cols=60></TEXTAREA></td>

    </tr>

  </table>

  &nbsp;<p>

  <input type="submit" value=Upload name="B1" >

  </form></P></CENTER></DIV>



</BODY></HTML>





__________________________________________________

Do You Yahoo!?

Yahoo! Sports - sign up for Fantasy Baseball

http://sports.yahoo.com

Message #2 by arshad siddiqui <ash_arshad@y...> on Sun, 3 Mar 2002 21:07:30 -0800 (PST)
<P>Hi,&nbsp;

<P>Actually the problem is that besides these dynamic

dropdowns I have some textboxes also.I did,nt got your

point.I think you mean to say that page1 will refresh

i.e it will submit to itself.then after pressing the

submit button it will go to page2 where all the

processing will be done on the form field.

<P>Please elaborate

<P>Thanks

<P>--Arshad--</P>



__________________________________________________

Do You Yahoo!?

Yahoo! Sports - sign up for Fantasy Baseball

http://sports.yahoo.com

Message #3 by arshad siddiqui <ash_arshad@y...> on Sun, 3 Mar 2002 06:13:48 -0800 (PST)
--0-1519801028-1015164828=:13460

Content-Type: text/plain; charset=us-ascii





Hi, 

I have made an asp page in which I have two select boxes.These two select boxes are dynamic taking out records from database.Uptil
this point everything is working perfect but the page is not refreshing automatically.because I am using onsubmit method so the page
refreshes after submitting.But if I add two three text boxes more then I need to know how I can get the two select boxes refreshed
without submitting.



Please help as this is very urjent.



Thanks



Regards



Arshad 



The below code is working perfect: 



<% 

'strconn = "Driver={SQL Server};Description=sqldemo;SERVER=127.0.0.1;UID=LoginID;PWD=Password;DATABASE=Database_Name 

set conn = server.createobject("adodb.connection") 

'conn.open strconn 

conn.Open "DBQ=" & Server.Mappath("Ramy.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};" 



'set objRS = createobject("ADODB.Recordset") 

sql="select CategoryID,CategoryName from Category" 

set objRS = conn.Execute (sql) 

'objRS.Open "select ID, strParent from Parents", strconn 

if Request("cboPrimary") = "" then 

lPrimary = objRS("CategoryID") 

else 

lPrimary = clng(Request("cboPrimary")) 

end if 

%> 

<form name=formTest action="dropdown.asp" method=POST> 

<p> 

<select name=cboPrimary size=1 onChange="formTest.submit();"> 

<%while not objRS.EOF 

lID = clng(objRS("CategoryID"))%> 

<option value="<%=lID%>"<%if lPrimary = lID then Response.Write " SELECTED"%>><%=objRS("CategoryName")%> 

<% objRS.MoveNext 

wend 

objRS.Close 

sql1="select SubCatID,SubCatName from SubCategory where CatID="& lPrimary &"" 

set objRS = conn.Execute (sql1) 

'objRS.Open "select ID, strChild from Children WHERE intParent=" & lPrimary, strconn 

%> 

</select> 

</p> 

<p> 

<select name=cboSecondary size=1"> 

<%while not objRS.EOF 

lID = clng(objRS("SubCatID"))%> 

<option value="<%=lID%>" selected><%=objRS("SubCatName")%> 

<% objRS.MoveNext 

wend 

objRS.Close 

'set objRS.ActiveConnection = nothing 

set objRS = nothing 

%> 

</select> 

</form>







---------------------------------

Do You Yahoo!?

Yahoo! Sports - Sign up for Fantasy Baseball


Message #4 by "Mitch Swetsky" <mswetsky@r...> on Sun, 3 Mar 2002 10:11:10 -0500
arshad siddiqui

There was the below code previously posted on auto refresh. maybe it can

help you.

mitch swetsky

----- Original Message -----

From: Jason Greenfeld-Unitek <jason.greenfeld@u...>

To: ASP Databases <asp_databases@p...>

Sent: Thursday, February 28, 2002 4:39 PM

Subject: [asp_databases] RE: Dynamic db based drop down





> page1.asp

> ----------

> <%

> item1 = request.form("item1")

> %>

> <form name="frmMain" method=post action="page2.asp">

> <select name="item1" onChange="subItem1()">

> <%'populate item1%>

> </select>

> <% if item1 <> "" and item1 <> "0" then%>

> <select name="item2">

> <%'populate item2 %>

> </select>

> <%end if%>

> </form>

>

>

> -------- Here is the JS function ------------

> <script language=javascript>

> function subItem1()

> {

> document.frmMain.action="page1.asp";

> file://This will re-submit the page to itself

> document.frmMain.submit();

> }

> </script>

>

>

> ----------------------------------------------------

> Jason A. Greenfeld

> Lead Software Developer

> Unitek Technical Services

>

>

> -----Original Message-----

> From: Chaikin, Yaakov Y [mailto:yaakov.y.chaikin@b...]

> Sent: Thursday, February 28, 2002 4:48 PM

> To: ASP Databases

> Subject: [asp_databases] RE: Dynamic db based drop down

>

>

> Yes, I am interested. Please send it to me.

>

> Yaakov Chaikin

> Software Engineer

> IT Department

> BAE SYSTEMS

> Voice:     xxx-xxx-xxxx

> Fax:         xxx-xxx-xxxx

> Yaakov.Y.Chaikin@b...

> -----Original Message-----

> From: Jason Greenfeld-Unitek [mailto:jason.greenfeld@u...]

> Sent: Thursday, February 28, 2002 4:29 PM

> To: ASP Databases

> Subject: [asp_databases] RE: Dynamic db based drop down

>

>

> Look at the onChange() event in JS... You can reload the page when you

> selece something from your first list. Or you may want to look into

> RDS(Remote Data Services). I have code for the onChange() event if you are

> interested.

>

>

> ----------------------------------------------------

> Jason A. Greenfeld

> Lead Software Developer

> Unitek Technical Services

>  xxx-xxx-xxxx  x3024

> -----Original Message-----

> From: Chaikin, Yaakov Y [mailto:yaakov.y.chaikin@b...]

> Sent: Thursday, February 28, 2002 4:43 PM

> To: ASP Databases

> Subject: [asp_databases] Dynamic db based drop down

>

>

> Hi!

>

> I have a question and I hope someone out there can help me:

>

> I am writing an asp page and I need the following affect.

>

> Let' say we are talking about a software package like Outlook 2002. I want

> the user to be able to pick 'Outlook' from a drop down list box and then

the

> second drop down list box should automatically fill in all the different

> versions of Outlook like 1997,1998,2000,2002. The trick is that everything

> is stored in a database, so it's not a question of client side javascript.

>

> What I wanted to know is if there a way to combine the client side js and

> server side js to create that affect. In other words, when the user

chooses

> something in the first drop down, it triggers some loading from the

database

> and fills the second drop down box.

>

> If it is possible, please explain how. If it's not, maybe you can suggest

> how to achieve a behavior that's at least close to this.

>

> Thanks.

>

> Yaakov Chaikin

> Software Engineer

> IT Department

> BAE SYSTEMS

> Voice:     xxx-xxx-xxxx

> Fax:         xxx-xxx-xxxx

> Yaakov.Y.Chaikin@b...

>




> $subst('Email.Unsub').




> $subst('Email.Unsub').




> $subst('Email.Unsub').

>




$subst('Email.Unsub').




  Return to Index