Solved

changing selection button state programmatically

Posted on 2000-03-05
8
193 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
 
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now