Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

changing selection button state programmatically

Posted on 2000-03-05
8
Medium Priority
?
202 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

636 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