Solved

changing selection button state programmatically

Posted on 2000-03-05
8
197 Views
Last Modified: 2012-05-04
I have the following asp page which i use to enter some search information

*******start******
<%@ Language=VBScript %>
<html>

<head>
<meta name="VI60_defaultClientScript" content="VBScript">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Sales Order Inquiry</title>
</head>

<body topmargin="0" leftmargin="0">

<p align="center">

<align="center"><font size="5"><font face="Arial Black">Product Lookup</font><br>

</font>

<form ACTION="plookup-details.asp" target="main" ID-ACTION="SUBROUTINE" METHOD="POST" NAME="frmProductLookup">
  <div align="center">
    <div align="center">
      <center>
      <table border="0" cellpadding="3" cellspacing="1">
        <tr>
          <td><b><font face="Arial" size="2">Search By:</font></b></td>
          <td></td>
          <td></td>
          <td></td>
        </tr>
        <tr>
          <td></td>
          <td><font face="Arial" color="#C71010" size="2"><strong><input type="radio" value="Material" name="R1">Material
        Number: </strong></font></td>
          <td><input NAME="txtMaterial" SIZE="22" MAXLENGTH="18" tabindex="1"></td>
          <td>(enter complete Material #)</td>
        </tr>
        <tr>
          <td></td>
          <td><font FACE="Arial" COLOR="#C71010" size="2"><strong><input type="radio" name="R1" value="Description" checked>Description:</strong></font></td>
          <td><input NAME="txtSearchString" SIZE="22" MAXLENGTH="18" tabindex="2"></td>
          <td>(enter search phrase)</td>
        </tr>
      </table>
      </center>
    </div>
    <center>
 
  </center></div><div align="center"><center><p><input NAME="btnSubmit" TYPE="image"
  SRC="images/btn_submit.jpg" BORDER="0" VALUE="Submit"> </p>
  </center></div>
</form>
</body>
</html>

******end******

how do i make the selection buttons change automatically to reflect the text box which has just had text entered.  That is, if i click on the text box for description, i would like the selection button to be automatically selected, than having to actually click on it myself before hitting the submit button.  Thanks.
0
Comment
Question by:gbr
  • 4
  • 2
  • 2
8 Comments
 
LVL 15

Expert Comment

by:robbert
ID: 2585839
"i would like the selection button to be automatically selected"

Sorry, I didn't understand.
0
 
LVL 15

Expert Comment

by:robbert
ID: 2585845
If there is anything entered in one of the text boxes, the selection button (image) should display another image? - That's easy - but it's time to sleep, now. There should be an answer.

Dreams to you, being most natural, and beloved.
0
 

Author Comment

by:gbr
ID: 2585865
let me clarify, ...

The asp page is a simple input screen which has 2 radio buttons and 2 text boxes.  The radio buttons are used to select which text box is to filled with data (used to search on).  Currently, when you click on a text box to enter text, you also have to click on its corresponding radio button, so that the next asp page knows that the value of that text box is to be used in the search.  So what i want to be able to do, is automatically select the corresponding radio button for a text box when it is clicked on for data entry.  There are no images to display, or anything like that, ...sorry for any confusion, ...if you paste the code into frontpage and view the file in design mode, and also run it in the browser, you'll see what i mean.  Thanks.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 1

Expert Comment

by:nunya
ID: 2585953
<form ACTION="plookup-details.asp" target="main" METHOD="post" NAME="frmProductLookup" ID-ACTION="SUBROUTINE">
      Search By:
      <br>
      <input type=hidden name=r1> <!-- holds the type of query.  Radio boxes are a pain to work with -->
      <br>
      Material Number:
      <input NAME="txtMaterial" SIZE="22" MAXLENGTH="18" tabindex="1" onfocus="window.frmProductLookup.r1.value='Material';window.frmProductLookup.txtSearchString.value=''" >
      (enter complete Material #)
      
      <br>
      OR
      <BR>
      
      Description:
      <input NAME="txtSearchString" SIZE="22" MAXLENGTH="18" tabindex="2" onfocus="window.frmProductLookup.r1.value='Description';window.frmProductLookup.txtMaterial.value=''" >
      (enter search phrase)
      <br>
      <input NAME="btnSubmit" TYPE="submit"  VALUE="Submit">
       
</form>


in your plookup-details.asp, r1 will contain the type of query and trim(request("txtMaterial")) & trim(request("txtSearchString")) will contain your data.  It will always be on or the other, not both, so just stick them both together in the processing page to save code.
0
 

Author Comment

by:gbr
ID: 2586029
Thanks for the proposed answer.  This does work well, but unfortunately my client has requested that the radio buttons remain and the text box that loses focus is not cleared.  This is because the end-users may have a change of mind when populating the text boxes, and if so, they should be able to just select the necessary radio button instead of retyping the text.  Also, the text for these fields is normally quite long, so it would be a pain to have to retype a field if the end-user did have a change of mind.
0
 
LVL 1

Accepted Solution

by:
nunya earned 100 total points
ID: 2586055
ok,
here is the only solution that I can see, as radio buttons are difficult to work with.  You will have 2 radio buttons with different names. only the radio that is checked will return a value, so check them both [searchType=request("r1") & request("r2") ]

good luck.


<snip.........>


        <tr>
          <td></td>
          <td><font face="Arial" color="#C71010" size="2"><strong><input type="radio" value="Material" name="R1" onclick="window.frmProductLookup.R2.checked=false">Material
        Number: </strong></font></td>
          <td><input NAME="txtMaterial" SIZE="22" MAXLENGTH="18" tabindex="1" onfocus="window.frmProductLookup.R2.checked=false;window.frmProductLookup.R1.checked=true"></td>
          <td>(enter complete Material #)</td>
        </tr>
        <tr>
          <td></td>
          <td><font FACE="Arial" COLOR="#C71010" size="2"><strong><input type="radio" name="R2" value="Description" checked onclick="window.frmProductLookup.R1.checked=false">Description:</strong></font></td>
          <td><input NAME="txtSearchString" SIZE="22" MAXLENGTH="18" tabindex="2" onfocus="window.frmProductLookup.R1.checked=false;window.frmProductLookup.R2.checked=true"></td>
          <td>(enter search phrase)</td>
        </tr>
<snip............>
0
 

Author Comment

by:gbr
ID: 2586256
Adjusted points to 100
0
 

Author Comment

by:gbr
ID: 2586257
Thank you so much, that worked really well
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add server behaviors to Dreamweaver CC 2015 2 183
Want the count number from this QUery 2 54
Downside of adding characters set in ASP pages 6 29
CREATE DATABASE 3 28
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question