Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. 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 Professional 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 February 26th, 2007, 03:28 AM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default add a new row when cursor comes to the last field

Hi,
Im developing package in ASP.
Wherein i have a row & i have the following details
ID, Name, City, Country.

if the cursor comes to country (on the lost focus event) i have to add another row which should allow me to enter another customers details (ID, Name, City, Country).

So, by default i should have only one row & once it comes to country. Another row should be displayed.

I hope i have not confused in sentence what i have put accrossed.

Need this @ the earliest.

Regards,
BullsB

 
Old February 26th, 2007, 09:04 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I am not sure what you mean. Are you looping through a row and if that row contains a country column you want to add a new row to the database?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429
 
Old February 26th, 2007, 06:43 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

mmmm - I am 'confused in sentence'

Wind is your friend
Matt
 
Old February 26th, 2007, 06:54 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

It seems you got your ASP answer in the JS area of this forum:

http://p2p.wrox.com/topic.asp?TOPIC_ID=56785

Wind is your friend
Matt
 
Old February 26th, 2007, 11:36 PM
Registered User
 
Join Date: Feb 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Matt,

How to add a new row (user defined)

I have the following fields in the first row (default)

ID
Name
City
Country

Aall these are input box wherein the user will enter the data.

After country i should have a option ADD ANOTHER ROW & when the user clicks the add new row button another row should be added allowing the user to enter the 2nd data (ID, Name, City, Country).

I doing a Project in ASP with ACCESS as backend.

Regards,
BullsB

 
Old March 3rd, 2007, 12:51 PM
Registered User
 
Join Date: Mar 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

You could do something nice and simple like this...

At top of the page have a quick checker. Say the page is called addrow.asp, use the following, changing your column names and table name, and setting your connection

Code:
Dim addRow

addRow = Request.Form("country")

if addRow <> "" Then

Dim strSql, objCmd, strConn, newCountry, newCity, newName

newName = Request.Form("name")
newCity = Request.Form("city")
newCountry = Request.Form("country")

strConn = ConnectionStringHere

strSql = "INSERT INTO tblTableName(colName, colCity, colCountry) VALUES ('" & newName & "','" & newCity & "','" & newCountry & "')"

Set objCmd = Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection = strConn
objCmd.CommandText = strSql
objCmd.Execute
Set objCmd = Nothing

Response.Redirect("addrow.asp")

End If
Then in the body of the page, have your form as usual, making sure the input box names match up with those above and that you are posting back to the same page the form is on. Good Luck
 
Old March 3rd, 2007, 12:53 PM
Registered User
 
Join Date: Mar 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Whoops, don't forget to End If below Response.Redirect

 
Old March 9th, 2007, 07:24 AM
Authorized User
 
Join Date: Jan 2007
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to saurabhj Send a message via Yahoo to saurabhj
Default

mmltonge,

Is this what bullsb wants?





-Saurabh
 
Old March 11th, 2007, 04:11 PM
Registered User
 
Join Date: Mar 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

From reading his questions, the code is a generic code solution to the problem, he will need to apply it to his own application for it to work though (own field names, own html etc)

I don't know for sure as he hasn't replied saying so :(






Similar Threads
Thread Thread Starter Forum Replies Last Post
Move cursor to beginning of field in form Odeh Naber Access 3 June 5th, 2007 04:21 PM
add a new row when cursor comes to the last field bullsb Javascript How-To 2 February 26th, 2007 11:26 PM
Want to pass a row cursor to a function in a query howardb1 Access VBA 0 April 24th, 2006 03:24 PM
Force cursor to next field dbartelt Access 2 June 21st, 2005 08:37 AM
position cursor at certain field on user form kliu9 Excel VBA 1 January 21st, 2005 06:51 AM





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