 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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
|
|
|
|

June 29th, 2004, 11:59 PM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
(URGENT)controls belonging to a form
Hi Everybody,
i have a webpage which has 3 forms and each of the form has a about 20 controls ...
now what i want is to have these controls displayed in a mixed manner on the screen ... moreover the ACTION pages of all the three forms are different ...
so is there anyway in which we can specify that TO WHICH FORM do they belong ....
my page is something like this
(not the actual page but what i want i like this)
FORM1 starts
TEXTBOX(of FORM1)
FORM2 starts
TEXTBOX(of FORM2)
BUTTON(of FORM1)
END OF FORM1
TEXTBOX(of FORM2)
END OF FORM2
------
so what i want to ask is can a 2nd FORM start before till 1st ends ..
if yes how to differenciate between the controls ...
Plz HELP URGENTLY
Sudhan.
__________________
--------------------------------------------------
Sudhan Kanitkar.
Everything Is In Our Hands.
|
|

June 30th, 2004, 12:17 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Unfortunately, you cannot put one form inside another form.
But you can put the inner form outside. If the second form requires some fields from first form also, you can adopt any of the following strategy.
1) repeat the field in the second form. (Put the second form completely outside first form. Have a different caption for second form to avoid any confusion to visitor).
2) Have only one form with two buttons. On clicking the first button, it will submit the form to a page. On clicking the other button, it will submit the form to another page. This can be done with Javascript / VBScript.
The required javascript is given below.
function button1_click()
{
document.form.action="page1.asp";
document.form.submit();
}
This you can call in the onClick event of first button. Replace form with name of form and page1.asp with the action page.
Similarly, the function for second buttion is:
function button2_click()
{
document.form.action="page2.asp";
document.form.submit();
}
Give appropriate captions for buttons also.
Best wishes
Madhu
|
|

June 30th, 2004, 12:24 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Sudhan,
You can have multiples forms, but not nested forms.
Why do you have to do it that way? Can you explain the real need for choosing that so called mixed manner?
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

June 30th, 2004, 12:29 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
I may be incorrect, but I think the answer is No.
In fact I don't think you can nest any html tags in this manner, including forms.
BUT, if you explain the effect you are after there may be a better solution.
For instance you can change the action attribute of the form tag with javascript to change the page to process the form.
This should give the same effect if you are not handling contols of the same name in each form.
======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
|
|

June 30th, 2004, 12:31 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Madhu,
what i want is something like this ..
there is a list of EMPLOYEES with MODIFY,DELETE Buttons adjecent to them ..
Emp1 [MODIFY] [DELETE]
Emp2 [MODIFY] [DELETE]
Emp3 [MODIFY] [DELETE]
... so on
Now all the [MODIFY] buttons go to a a common MODIFY page
and [DELETE] buttons go to a common delete page ..
Any Ideas ...
Sudhan.
|
|

June 30th, 2004, 12:49 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Sudhan,
For this you dont have to use ***confusing*** nested forms, instead you can keep them as normal buttons and can write the submit on ONCLICK so as to take to the relavant page.
But I assume, you should be showing the names/some minimal details about EMP1, EMP2, EMP3... each having a MODIFY and DELETE links besides it. So on clicking EMP1 modify button/link you should show the details of EMP1 in the Modify Form page. Is that right?
If so, You can keep them(MODIFY/DELETE) as links, rather using buttons, as it would look cluttered from the User's perspective. I won't recommend that kind of UI.
Instead you can keep the EMP1, EMP2, ... themsleves as links and clciking that you can pass the EMPID or something like that as a Querystring, which you can pull into the modify page.
Code:
<a href='modify.asp?EmpId=<%=rs("empid")%>'><%=rs("EmpName")%></a>
This way it would look kind of professional. And use check boxes for DELETE functionality, so that one can delete multiple records at one shot, than Deleting one by one. In User friendliness perspective, I wont recommend you using DELETE buttons for each EMP.
Hope that helps.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

June 30th, 2004, 12:49 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Dear its quite easy you can assign EMPid to the button and post it to next page where you want the desired action like modigy or delete
Love 4 all
|
|

June 30th, 2004, 01:09 AM
|
|
Authorized User
|
|
Join Date: Jun 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Vijay,
Thanks ...
That sounds real great ....
I am gonna try and implement that ....
will let you know how it goes along ..
thanks QAZI .. but i think and you would also agree that the solution suggested by Vijay is much better ..
Sudhan.
|
|

June 30th, 2004, 01:22 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes I agreed with vijay but I was assuming that it is ur requirement to use buttons thats why I suggested you other wise I also used this methoed quite a lot in my sites
Cheere
Love 4 all
|
|

June 30th, 2004, 01:29 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Here is another solution. You can include two submit buttons on the same form. Like this.
<form name="frm_test" action="testfb.asp" method="post">
<input type="submit" name="btn_edit" value="Edit">
<input type="submit" name="btn_delete" value="Delete">
</form>
When you click edit button, only that button name (btn_edit) will be passed to the action page. Similarly when you click delete button, only the value btn_delete will be passed to the action page.
You can use the following code to detect which button is clicked.
dim str_action_requested
For each item in Request.Form
if(left(item,4)="btn_") then
if(right(item, len(item)-4)="edit") then
str_action_requested="Edit"
elseif(right(item, len(item)-4)="delete") then
str_action_requested="Delete"
end if
exit for
end if
next
if(str_action_requested="Edit") then
' do edit work
Response.Write("Edit work starts...")
elseif(str_action_requested="Delete") then
' do deletion work
Response.Write("Deletion work starts...")
end if
|
|
 |