473,287 Members | 3,319 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Convert the option value, using textbox value

1
Hi,
Can you please help me, I want to write a dropdown box that have an option 'Other' but when the Other is selected my textbox need to be enable and take the textbox value as an output instead of Other.



[HTML]<script language=javascript type="text/javascript">
function pairSelectToOther(whichCtrl,otherCtrl,otherStr)
{
if(whichCtrl.options[whichCtrl.selectedIndex].value == otherStr)
{
otherCtrl.disabled = false;
alert("Please provide specification")
}
else
{
otherCtrl.disabled = true;
//if the guy selects some other value in the select box , after inputting into the
//other textbox, the value shouldn't get posted.
otherCtrl.value = "";
}
return true;
}
</script>

&nbsp;&nbsp;
<select id="selectlist" name="role" style="font-family: Arial; width:200px;" onChange="return pairSelectToOther(this,Reason_Other,'Other')">
<option value="Lead Arrager">Lead Arrager</option>
<option value="Joint Lead Arrager">Joint Lead Arrager</option>
<option value="Dealer">Dealer</option>
<option value="Finacial Advisor">Finacial Advisor</option>
<option value="Joint Finacial Advisor">Joint Finacial Advisor</option>
<option value="Lender">Lender</option>
<option value="Lead Manager">Lead Manager</option>
<option value="Joint Manager">Joint Manager</option>
<option value="Underwriter">Underwriter</option>
<option value="Other">Other</option>
</select>
<% //Done Role Changes (Other ) %>
<br>
<br>
<b></b><i style="font-family: Arial; color: #00376c;"><font size="2">(if <b>'Other'</b>, please specify)</font></i></b>
<br>
&nbsp;&nbsp;

<input style="font-family: Arial;" type="text" name="Reason_Other" disabled size="38">[/HTML]
Feb 19 '07 #1
2 2459
abctech
157 100+
Hi,

I tested your code, it is working,

If I'm not wrong you need that when the user selects 'Other' option from the Dropdown you want the textfield to be enabled or else not which is happening through your code.

If you want the value typed in the textfield you can get it by saying -

document.WhateverYour FormName.Reason_Other.value ;

OR

give your textfield an id and then you can access the text by using getElementById() i.e -

document.getElementById("WhateverIdOfTheTextField" ).value

Is this your requirement or something else?
Feb 19 '07 #2
acoder
16,027 Expert Mod 8TB
Hi,
Can you please help me, I want to write a dropdown box that have an option 'Other' but when the Other is selected my textbox need to be enable and take the textbox value as an output instead of Other.
There are two ways you can deal with this. One is to do all of it on the server side and don't depend on the client-side, i.e. check for 'Other', if found, instead of using the select dropdown value, use the textbox value.

The other method (which you are probably looking for) is actually quite simple. Just set the value of the 'Other' option to the textbox value. Then that will be posted to your server-side script.
Feb 19 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
4
by: kindermaxiz | last post by:
//I have a form such as this: echo "<form method=\"post\" action=$php_self> <BR><INPUT TYPE=\"TEXT\" NAME=\"textbox\" SIZE=\"40\"> <BR> <select name=\"searchlist\"> <option...
8
by: Assimalyst | last post by:
Hi i have a value entered into an asp text box, procedureDateTxtBx.Text, thet has the format dd/MM/yyyy. I need to convert this into a format recognisable by SQL server in order to properly query...
12
by: DC Gringo | last post by:
How can I convert this pubLatest to a date with format "m/d/yyyy"? Dim pubLatest As New Date pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Value -- _____ DC G
5
by: manmit.walia | last post by:
Hello All, I am stuck on a conversion problem. I am trying to convert my application which is written in VB.NET to C# because the project I am working on currently is being written in C#. I tried...
4
by: Edwin Knoppert | last post by:
In my code i use the text from a textbox and convert it to a double value. I was using Convert.ToDouble() but i'm used to convert comma to dot. This way i can assure the text is correct. However...
10
by: Gary | last post by:
Hello, Anyone know how to do the following in c# - using inline codeblocks? <% If Request.Form("Name") = "Gary" Then %> <asp:RequiredFieldValidator ID="GarysValidation" ErrorMessage="Gary,...
3
by: mrajanikrishna | last post by:
Hi Friends, I am accepting a number from the user entered in a textbox. I want to assign to a variable in my code and assignt this to that variable. double num1 = (double)txtNum1.text; ...
1
by: sparksol | last post by:
I have a form with a drop down box. If you select an option in the drop down box (depending which option is selected) one or two textbox(es) and a submit button display. I would like to keep the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.