• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

changing selection button state programmatically

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
gbr
Asked:
gbr
  • 4
  • 2
  • 2
1 Solution
 
robbertCommented:
"i would like the selection button to be automatically selected"

Sorry, I didn't understand.
0
 
robbertCommented:
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
 
gbrAuthor Commented:
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
nunyaCommented:
<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
 
gbrAuthor Commented:
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
 
nunyaCommented:
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
 
gbrAuthor Commented:
Adjusted points to 100
0
 
gbrAuthor Commented:
Thank you so much, that worked really well
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

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.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now