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 | Calendar | 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 March 9th, 2006, 02:12 PM
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Greying out dropdown fields in another form

I have a page split up into two forms. Both the forms are method GET. The first form has a text field and a dropdown with a submit button ‘Retrieve SKUs’. While the second form has two dropdown menus and a ‘Create Reports’ button.
The flow of events is such. The user enters a name in the text field, then selects something from the dropdown and clicks on retrieve skus. The user then selects something from the other two dropdown menus in the second form and clicks on ‘Create Reports’.
Problem: When the page first loads, I need to have the two dropdowns in the second form greyed out or disabled. Once the user enters a name and selects something from the dropdown from the first form and then clicks on retrieve SKUs, after the page refreshes the other two dropdowns should then get enabled.
Following is the code:

================================================== ===================
<form name="Report_Drive" action="frm_pop_results.asp" method="GET" onsubmit="return Form1_Validator(this)">
<table border="0" width="600" cellpadding="5" cellspacing="5">
    <tr>
        <td align="left">Enter Report Name</td>
        ………………
    </tr>

//code for dropdown here...

<input type="submit" name="RetrieveSKUs" value="Retrieve SKUs">
    </td>
    </tr>
  </form>

//code for second form follows...

   <form name="Results_Report" action="reports_results_page.asp" method="get">

    <tr>
       <td align="left">Select a Product</td>
        <td><select name="product" size="1" value=product id=product style="top: 30px; left: 393px; width: 200px">
    <OPTION value=0 id=0>Select a Product...
    <% Dim vls_product_name
    ………….
        </select>
....

    <td><select name=quarter size="1" id=quarter style="top: 30px; left: 393px; width: 200px">
    <OPTION value=0 id=0>Select a Quarter...
    <% Dim vls_quarter
    strSQL = "SELECT Quarter FROM QUARTER "
    ………………

    </select>
    </td>
</table>
Form Validator functions to give you a better idea…

function Form1_Validator(theForm)
{
    var alertsay = "";

    // check to see if the field is blank
    if (theForm.report_name.value == "")
    {
        alert("You must enter a Report Name.");
        theForm.report_name.focus();
        return (false);
    }

    // check if no drop down has been selected
    if (theForm.drive.selectedIndex < 0)
    {
        alert("Please select one of the following Drive Periods from the list.");
        theForm.drive.focus();
        return (false);
    }

    // check if the first drop down is selected, if so, invalid selection
    if (theForm.drive.selectedIndex == 0)
    {
        alert("Please select one of the following Drive Periods.");
        theForm.drive.focus();
        return (false);
    }

}


function validate(link)
 {

    if(document.Results_Report.product.value == 0) // Check if the Product is null
            {
             alert( "Choose a Product Name.");
             document.Results_Report.product.focus();

             }
    else if(document.Results_Report.quarter.value == 0) // Check if the Quarter is null
            {
             alert( "Choose a Quarter.");
             document.Results_Report.quarter.focus();

             }

    else if (!checkbox_checker())
    {
        alert("Please make atleast ONE SKU selection.")
    }
    else
    {
    submitDrive(link);
    }
 }
================================================== =============


Reply With Quote
  #2 (permalink)  
Old March 10th, 2006, 04:18 AM
Friend of Wrox
 
Join Date: Nov 2005
Location: Rotterdam, , Netherlands.
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi rabbit124,

The problem is not completely clear to me so correct me if I'm wrong.
btw what are Skus

1. the first form has a field for "Name"
2. when you click "retrieve SKUs" it checks if there is something or not.
3. when there is data retrieved the pulldowns should be enabled.
4. (not sure about this one) the pulldowns should have the retrieved values.

What about only refreshing the second form using AJAX.

Need help just ask.

__________________________________________________ ________
This is my junk I'm gona eat it
Reply With Quote
  #3 (permalink)  
Old March 10th, 2006, 12:37 PM
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello DJ Kat,

1. Yes, the first form has a field Name AND a dropdown (Drive Period). This form also has Retrieve SKUs submit button (which on clicking checks with JS validator functions if entries have been made in the text field and dropdown menu then runs some results based on those values and displays them in a table below. Then user moves on to the second form-product and qrtr)
2. Yes, when the data is retrieved on clicking retrieve skus, the pulldowns in the second form for product and quarter should be enabled. Initially when the page loads they should be disabled. On clicking the submit button a.k.a Retrieve SKUs, the two pulldowns should be enabled. FYI, SKUs are like a serial number for a particular product item.

Here is what I have so far…
function enableField()
{
document.forms.Results_Report.product.disabled=f alse; document.forms.Results_Report.quarter.disabled=fal se;
}
///////////
<input type="submit" name="RetrieveSKUs" value="Retrieve SKUs" onclick="javascript:enableField()">
////////
<td align="left">Select a Product</td>
        <td><select name="product" size="1" value=product id=product disabled=”true” style="top: 30px; left: 393px; width: 200px">
    <OPTION value=0 id=0>Select a Product...
///////

3&4: Now the problem here is, when the page first loads, the product and quarter fields (from the second form) are disabled, on entering report name, selecting from Drive Period dropdown and clicking on retrieve skus submit button, the page refreshes, the dropdowns get enabled for a split second and then gets disabled again. My problem is how do I get the second form to enable its dropdowns when the submit button in the first form has been clicked (ofcourse they will be disabled initially)
Hope you can understand the problem.
Reply With Quote
  #4 (permalink)  
Old March 12th, 2006, 07:35 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

I believe disabled=”true” is incorrect syntax all the is required is the word disabled inside your select tag. I recognize your post to do with a previous problem, I still got a bit lost understanding it.

If you want to diable a select list simply place a condition around it. the same as you did in the last post.

EG:
 <select name="product" size="1" value=product id=product style="top: 30px; left: 393px; width: 200px" <% if trim(request.querystring("valueName")) <> "" then response.write " disabled " end if %>>

BTW why do you place quotes around some values and not others? I notice you still use in-line styles. Are you aware of how useful and time saving CSS is?

Wind is your friend
Matt
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
2 table fields into 1 dropdown selectbox sdagger Classic ASP Basics 2 September 23rd, 2008 03:42 PM
Form Fields Terry J Daichendt JSP Basics 2 September 15th, 2008 05:53 PM
copy fields from Form to new form - openargs justabeginner Access VBA 1 February 4th, 2007 01:28 PM
Dropdown List search form [?] antonioluis Dreamweaver (all versions) 1 May 25th, 2005 01:10 AM
Question Re: DropDown box in Windows Form savoym C# 5 March 15th, 2004 09:10 AM



All times are GMT -4. The time now is 07:37 PM.


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