Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 29th, 2004, 11:59 PM
Authorized User
 
Join Date: Jun 2004
Location: , , India.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to silver_cuts Send a message via Yahoo to silver_cuts
Default (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.
Reply With Quote
  #2 (permalink)  
Old June 30th, 2004, 12:17 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

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
Reply With Quote
  #3 (permalink)  
Old June 30th, 2004, 12:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
Reply With Quote
  #4 (permalink)  
Old June 30th, 2004, 12:29 AM
Friend of Wrox
Points: 2,376, Level: 20
Points: 2,376, Level: 20 Points: 2,376, Level: 20 Points: 2,376, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , Australia.
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

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.
======================================
Reply With Quote
  #5 (permalink)  
Old June 30th, 2004, 12:31 AM
Authorized User
 
Join Date: Jun 2004
Location: , , India.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to silver_cuts Send a message via Yahoo to silver_cuts
Default

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.


Reply With Quote
  #6 (permalink)  
Old June 30th, 2004, 12:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

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
Reply With Quote
  #7 (permalink)  
Old June 30th, 2004, 12:49 AM
Friend of Wrox
Points: 1,288, Level: 14
Points: 1,288, Level: 14 Points: 1,288, Level: 14 Points: 1,288, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2004
Location: Stockholm, Sweden
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

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
Reply With Quote
  #8 (permalink)  
Old June 30th, 2004, 01:09 AM
Authorized User
 
Join Date: Jun 2004
Location: , , India.
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to silver_cuts Send a message via Yahoo to silver_cuts
Default

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.

Reply With Quote
  #9 (permalink)  
Old June 30th, 2004, 01:22 AM
Friend of Wrox
Points: 1,288, Level: 14
Points: 1,288, Level: 14 Points: 1,288, Level: 14 Points: 1,288, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2004
Location: Stockholm, Sweden
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

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
Reply With Quote
  #10 (permalink)  
Old June 30th, 2004, 01:29 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
parent form from child form - urgent plz netfresher C# 1 November 8th, 2006 06:59 PM
Need urgent help loading user controls at runtime rpeters83 ASP.NET 2.0 Professional 7 September 3rd, 2006 10:17 AM
urgent custom control with collection of controls dd_smith Pro VB.NET 2002/2003 1 December 19th, 2004 06:05 PM
Controls on another form bjackman Access VBA 2 March 25th, 2004 01:30 AM



All times are GMT -4. The time now is 10:36 AM.


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