Wrox Programmer Forums
|
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 August 10th, 2004, 02:19 AM
Authorized User
 
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default submit problems

Hi all
I read through some posts and i feel that one 'Form' can only have one 'Submit' button. well, not sure of that

suppose i have a form which shows a table from database;
i provide a checkbox in front of each row of the table. the user check the item which he/she would like to process. After checked wat they want, press "Edit" or "Delete" button, My page will according to the option, show the edit or delete page with parameters passed.

submit type used becuz item ID(parameters)can be passed to next page.

Could you tell me how to achieve this?

rgds


 
Old August 10th, 2004, 02:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

One Question I have on that EDIT part.

When I select multiple rows(checkboxes), and press edit, how would I be able to edit the values of all those rows I selected? I just wonder how you are going to accomplish that.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 10th, 2004, 02:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Forgot to mention about multiple submit buttons in single FORM in my previous post.

You can have multiple submit buttons in a form. Want to test that out? Try this code.
Code:
<%

If len(Request.Form("Button1"))>0 then strButtonVal = Request.Form("Button1")
If len(Request.Form("Button2"))>0 then strButtonVal = Request.Form("Button2")
If len(Request.Form("Button3"))>0 then strButtonVal = Request.Form("Button3")

%>

<html>
<body>
<form action="" method="post">
<input type="text" name="mytxt" value='<%=strButtonVal%>'>
<input type="submit" name="Button1" value="submit1">
<input type="submit" name="Button2" value="submit2">
<input type="submit" name="Button3" value="submit3">
</form>
</body>
</html>
Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 10th, 2004, 02:50 AM
Authorized User
 
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by happygv
 One Question I have on that EDIT part.

When I select multiple rows(checkboxes), and press edit, how would I be able to edit the values of all those rows I selected? I just wonder how you are going to accomplish that.
hmm, good question.
juz like MS Excel, you can Edit any part of the table any rows of tat, then simply click save button once.
i want to achieve tat effect.
batch update isn't it a good idea?:D
 --------------------
thanks dude.
 yar, you are right. mutiple submit buttons can be distinguished by its value.

 then i would like to use another page (streaming page)to call EDIT or DELETE pages.
then parameters have to be passed to the streaming page and pass again to the Edit or Delete Page. is it OK in the sense of efficiency?


rgds





 
Old August 10th, 2004, 03:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi there,

Is that you are talking about doing it with ASP/ASP.Net? I am not so good at ASP.Net, just starting up kind of...

But using ASP how are you going to accomplish. IMO you cannot do that with all those rows making editable and updating it as a batch. Though it can be done, it would require much of effort and use a lot of server resource.

Efficiency??? hmmm... For edit I wont vote for that method. I don't think that could be an efficient method of editing rows. Commonly used way is allowing to Edit one row at a time.

For Delete you can always do that with single or multiple rows being selected.

Passing parameters??? You don't have to worry much about that. As you can use POST method in FORM, that submits values to the web server and always that can be requested after submit and processed. Like, you can name all the check boxes with same name, and on request after submit, it all comes as a COMMA separated string, which can always be easily handled later for processing.

Does that explain?
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 10th, 2004, 03:48 AM
Authorized User
 
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote: Commonly used way is allowing to Edit one row at a time.
I will remember this...

Quote:
quote:
 You don't have to worry much about that. As you can use POST method in FORM, that submits values to the web server and always that can be requested after submit and processed.

DOes tat mean once submit then can request.Form("Name") forever?
IMO only the target page (Action="Target Page") can request. AM I wrong?

 
Old August 10th, 2004, 04:37 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes, you are right. The page that is mentioned in the ACTION= attribute of FORM tag and request any of the FORM fields. But All those EDIT and DELETE jobs can be handled in one such page, based on the Submit button that is clicked.

Hope that explains.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 10th, 2004, 08:26 AM
Authorized User
 
Join Date: Aug 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Commonly used way is allowing to Edit one row at a time.
That's the most efficient way to utilize the code, and the easiest. It does, however, greatly detract from the usability of whatever you're creating. I worked on a project a few years ago where users had to add/edit 100+ rows of data on a regular basis. It could take them up to an hour and, after eventually switching to a loop to update all the rows at once, we cut that time down to about 10 minutes. It does add more overhead to the server, but if you're going to be adding lots of data on a regular basis, it might be worth it.

Is this something that could work for you?
Code:
<form action="test.asp" method="post">
<input type="text" name="item51_name">
<input type="text" name="item51_color">
<input type="hidden" name="item51_id" value="51">
<input type="text" name="item52_name">
<input type="text" name="item_52_color">
<input type="hidden" name="item52_id" value="52">
<input type="text" name="item53_name">
<input type="text" name="item_53_color">
<input type="hidden" name="item53_id" value="53">
<input type="submit" name="submit">
</form>
<%
For x = 1 to (Request.Form.count-1) 
        strSql = "UPDATE tblItems SET item_name = '" & Request.form.item(x) & "', "
        x=x+1 'move to the next form element
        strSql = strSql & "item_color = '" & Request.form.item(x) & "' "
        x=x+1 'move to the next form element
        strSql = strSql & " WHERE item_id = " & Request.form.item(x) & ";"

        response.write strSql & "<br>" 'execute SQL
Next    
%>
As for using a streaming page to call the edit or delete pages, if you use include files on the streaming page, the values from the form are automatically passed to the included pages. So if you just use include files, you won't have to do any additional programming to pass the values to the edit or delete pages.

I hope this helps.

Chris




 
Old August 10th, 2004, 08:40 PM
Authorized User
 
Join Date: Aug 2004
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

great thanks!

 
Old August 10th, 2004, 09:22 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes there is a way of looping through the edited values and updating too. In your case you will not know how many rows you will have to edit, that is decided through the values selected using CHECKBOXES. So the Editable fields for all those has to be dynamic, which is an over-head to the server. Also the page would look long/wide/cluttered with all those rows editable.

But remember, you have another headache of ERROR handling when you go for such bulk-edit mode. You should be careful about that as you are manipulating with data in the database. And maintaining form values in case of ERRORs. Yet another headache is Validation of all those dynamic form fields, be it client-side or server-side validation.

On the Usability/user-friendly perspective, I would not recommend this kind of approach, as the user will have to edit too many rows at a time and have to be extra cautious to while filling the form. If session is involved and that expires before the user takes his own time to fill the form, then the user will have to re-enter all the data, which the user would hate the most to do in this world. So you got to consider all those factors before deciding to take up that route.

Just in case the user tries to minimize the browser just before submitting the form, to check something else, instead closes the browser.;) Not many does that. But that can happen still. So, now filling the form again in that case would drive the user crazy. It is all in the manner we present it to the end user.

Just wanted to put these across before you proceed further.
Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to submit the different data on single submit pushpa Classic ASP Databases 1 January 24th, 2007 07:10 PM
How can we submit a form without a submit butto phpsharma BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 October 20th, 2003 08:50 AM
submit kilika Javascript How-To 2 September 16th, 2003 05:43 PM
submit kilika VBScript 0 September 16th, 2003 01:38 PM





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