Solved

changing selection button state programmatically

Posted on 2000-03-05
8
196 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
two submit buttons one form 15 87
Auto Submit on dropdown box 14 67
Writing comments on <p></P> or paragraph 2 14
Diminish Pop-up  in 3 seconds 7 23
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 …
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

832 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