How to change a list/menu to a text field when 'Other' is chosen?

Hi there. I've been trying to solve this for a week now and I have depleted all my resources, that is why I'm here. I even went to jquery but nothing works and I think I was over-complicating this way too much.
In short: I have a contact form, which have a list/menu with validation, and one of the options of that list/menu is "other". What I want is that when the user select "other" automatically change to a text field in order to let the user put his custom color. This is what I have:
<form method="post" action="process.php">
<span id="spryselect1">
<label for="colors"></label>
<select name="colors" id="colors">
<option selected="option1">Blue.</option>
<option value="option2">White</option>
<option value="option3">Red</option>
<option value="other">other</option>
</select>
<span class="selectRequiredMsg">Please select a colour.</span></span>
<input type="submit" value="Send">
</form>
I know now that the approach is to show/hide a separate textbox besides the other... well. I don't know how to implement that, I think I really need your help guys. I'm completely frustrated.
Thanks in advance.

Have a look at the following
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link href="http://labs.adobe.com/technologies/spry/widgets/selectvalidation/SpryValidationSelect.css" rel="stylesheet">
<link href="http://labs.adobe.com/technologies/spry/widgets/textfieldvalidation/SpryValidationTextField.css" rel="stylesheet">
<style>
.hidden {display:none;}
</style>
</head>
<body>
<form action="" method="post">
  <span id="spryselect1">
  <label for="colors">Colours:</label>
  <select name="colors" id="colors" onchange="MyOnClickHandler(this.value)">
    <option value="">Please select...</option>
    <option value="blue">Blue</option>
    <option value="white">White</option>
    <option value="red">Red</option>
    <option value="other">other</option>
  </select>
  <span class="selectRequiredMsg">Please select a colour.</span></span><span id="sprytextfield1">
  <input name="other" id="other" class="hidden" type="text">
  <span class="textfieldRequiredMsg">A value is required.</span></span>
  <input name="" type="submit">
</form>
<script src="http://labs.adobe.com/technologies/spry/includes_minified/SpryDOMUtils.js"></script>
<script src="http://labs.adobe.com/technologies/spry/includes_minified/SpryValidationSelect.js"></script>
<script src="http://labs.adobe.com/technologies/spry/includes_minified/SpryValidationTextField.js"></script>
<script>
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
var sprytextfield1;
function MyOnClickHandler(value) {
     if(value =='other') { //show text field and set validation
          if(!sprytextfield1){
          sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
          Spry.$$('input#other').removeClassName('hidden');
     } else { //hide textfield and destroy validation
          if(sprytextfield1 && sprytextfield1.destroy){
               sprytextfield1.resetClasses();
               sprytextfield1.destroy();
               sprytextfield1 = null;
          Spry.$$('input#other').addClassName('hidden');
     return false;
</script>
</body>
</html>
Gramps

Similar Messages

  • How do I auto populate the date into text fields when form is first opened?

    Hello,
    I read all about the changing the scripts but its not really working for me. I was hoping someone could help me with directions on how to auto populate the date into designated text fields when my adobe document is first opened?
    I am working in Adobe Acrobat 9.
    Thank you,
    Sheri

    When you add a new document JavaScript (Advanced > Document Processing > Document JavaScripts > Script Name (enter something) > Add), you will be given a function skeleton by default. Just delete it and enter the line of code I showed above. Now, whenever the document is opened, the code will get triggered and the field will be updated with the current date. There is no "Document Open" action (at least that's accessible via Acrobat's UI), but this is effectively the same thing since any document-level JavaScripts are executed when the document is opened.

  • How to change solid size automatically to a text field?

    Does anyone know how to make a solid change the scale parameter automatically when the layer above it goes longer / shorter then it? I’m trying to have a text field that can be changed and need the solid underneath it to change the scale parameter when the text goes longer or shorter then the solid. Sounds like an expression…

    I got this working with the following expression:
    xExtra=effect("xExtra")("Slider")
    yExtra=effect("yExtra")("Slider")
    x=thisComp.layer("Text 1").sourceRectAtTime().width + xExtra;
    y=thisComp.layer("Text 1").sourceRectAtTime().height + yExtra;
    [x,y]
    The Problem:
    it resizes from the middle out. I need the text justified left (which it is not, because then it is not lined up and if I drag the shape layer over to line it up as I add text it still goes from the middle out and does not completly cover the whole text) and have this expression change only the length of the box below on the right side and keep the left justified.
    Any Ideas?

  • How to change display type of an existing Text field to a Picklist

    I need to modify an existing Text Field in the Expense report page to a Picklist and associate values to that picklist. Is this possible through Personalization ? If not, can someone let me know how this can be achieved.
    Thanks
    Meera

    We created an item instead of creating a region and extending it. But here we have one more problem. The item we added is getting displayed at Button Layout section
    Where did you create it, you should choose the appropriate region's create item icon to add it. If think you added it in a wrong place.
    And one more issue that we are facing is - we are getting an error (No current row for View (<ViewInstance>)). when we clicking the save or next button in that page. Please let us know how to update the existing controller and save the value in that picklist item to the database.
    There are two issues here,
    - you are trying to replace the messageTextInput with the poplits, so you should get the viewAttribute and viewUsage name associated with the textinput and provide that as part of the messageChoice definition.
    - the picklist VO which is the datasource for the poplist is not included in the existing seeded AM since you didnot follow the steps I mentioned earlier to create the stacklayout and add it instead of adding it directly. Probably you are on a version earlier than CU2, in which case you need to follow the additional steps mentioned below.
    While adding the poplist donot specify the picklist view definitions,
    1. extend the controller on the page and write your controller
    2. Call super first
    3. get a handle to the root AM and create the viewobject dynamically by using the createViewObject API on the AM.
    4. get a handle to the poplist in the controller, you need to do this first before creating the poplist in the personalization(otherwise the page might error out if you created the poplist first without the picklist view definition properties) and set the display, value attributes as well as the picklist view defintions based on the viewobject you created in step 3.
    5. Use personalization and add your poplist
    6. replace the old controller class with the new one.
    You are done.

  • How do I make the menu title a different color when it is the active menu in Spry horizontal menu?

    How do I make the menu title a different color when it is the active menu in Spry horizontal menu?
    Dreamweaver CS5.5
    Apple OS X.6.8
    View site at: http://dorsay-easton-indian-law.com/staging/index.html
    Steps:
    1. Click link to land on Home page
    2. View Home link in Spry horizontal navigation menu
    Actual:
    Home menu title is the same color as all of the others.
    Expected:
    The title of the active menu is       color: #FFC.
    I was hoping that a:active would give me this functionality, but that's not how it is described. Any suggestions are welcome!

    Nothing I have tried in the template makes the BODY tag editable. That's why I'm wondering how to disconnect the template from the individual pages. Adding an ID to each body tag is a prerequisite of the how-to page you supplied.
    You don't make the <body> tag editable in a Template.
    You make attributes of the <body> tag editable.
    Don't disconnect the Template from the child pages.
    Specify editable tag attributes in a template
    http://help.adobe.com/en_US/dreamweaver/cs/using/WScbb6b82af5544594822510a94ae8d65-7aa3a.h tml
    In the Template:
    Select the <body> tag (either in the Tag selector or click inside the <body> tag in Code View)
    Modify > Templates > Make Attribute Editable
    Select ID from the Attribute dropdown menu
    If there's no existing ID attribute then click Add and type ID into the next dialogue box
    Attribute: ID
    Check the box to "Make attribute editable"
    Enter anything into the Label field as a default e.g. foo
    OK
    Dreamweaver will change the <body> tag to read <body id="@@(foo)@@"....
    Now the ID is editable
    Save the Template and update the child page
    In each child page:
    Modify > Template Properties
    Select the id attribute from the list (it's probably the only one listed)
    Change its name in the box to whatever name matches your CSS rule for the active state for that page
    OK
    Save
    Upload

  • How to change the font size of the text that is revolving ?

    Hi there,
    I am using the Revolution theme.
    How to change the font size of the text that is revolving (on the first menu page) ?
    Thanks

    You can't.  That's hard coded into the theme.
    OT

  • How to change a phone number that was set-up when ipad was being set-up. It was my wife's and not mine. want my number as the main number.

    How to change a phone number that was set-up when you first set Ipad up. Took wife's number instead of mine. Her number is on i-cloud and messaging, face time.

    Goto -settings-iCloud-delete account u will then have to set up a new iCloud account.if u do this it will delete anything u may have backed up in  iCloud on your old account.

  • Hi, I recently changed my username for my iTunes/iCloud account. Can anyone tell me how i change the username on my iCloud iPad? When I go onto setting to change it it keeps the username grey so I can't even select it?

    Hi, I recently changed my username for my iTunes/iCloud account. Can anyone tell me how i change the username on my iCloud iPad? When I go onto setting to change it it keeps the username grey so I can't even select it?

    Welcome to the Apple Community.
    In order to change your Apple ID or password for your iCloud account on your iOS device, you need to delete the account from your iOS device first, then add it back using your updated details. (Settings > iCloud, scroll down and hit "Delete Account")
    Providing you are simply updating your existing details and not changing to another account, when you delete your account, all the data that is synced with iCloud will also be deleted from the device (but not from iCloud), but will be synced back to your device when you login again.
    In order to change your Apple ID or password for your iCloud account on your computer, you need to sign out of the account from your computer first, then sign back in using your updated details. (System Preferences > iCloud, click the sign out button)
    In order to change your Apple ID or password for your iTunes account on your iOS device, you need to sign out from your iOS device first, then sign back in using your updated details. (Settings > iTunes & App store, scroll down and tap your ID)
    If you are using iMessages or FaceTime, you will also need to log out and into your ID there too.

  • How to change the node's icon in a tree when the node collapse or expand?

    how to change the node's icon in a tree when the node collapse or expand?

    Hi,
    You may need to use custom skin for that.
    -Arun

  • How to change apple ID from U.S to Asia when i still have credit on my U.S

    how to change apple ID from U.S to Asia when i still have credit on my U.S

    You're going to find that answer from Apple Support. Choose iTunes in Apple Support.
    Apple Support
    http://www.apple.com/support/

  • How to change a prospect status to customer in BP,when the prospect turns out to be a potential customer?Please help me with the details.

    How to change a prospect status to customer in BP,when the prospect turns out to be a potential customer?Please help me with the details.
    Moderation: Kindly search before you post

    Dear Ramesh,
    Using Account life cycle we can record the different stages of a BP.
    But at any point of time we can hold one Stage at Business partner.and once we change status Prospect ro Customer. We can't able to see Prospect Status in that BP.
    Ex -
    Stage A- Potentail
    Stage B- Prospect
    Stage C- Customer
    with the help of UI configuration we can define.
    Need your comment,
    Thx
    Karthik

  • How can I limit numeric codes in a text field?

    How can I limit numeric codes in a text field? For example I want to list Industry SIC codes and I want to block someone from inputting an exlcuded industry code.

    We don't offer that type of input restriction for a text field. 
    Can you create a list of all allowed codes and use a Drop Down menu or Single/multiple Choice field? 
    Thanks,
    Josh

  • Change the font color of a text field in a table by key-combination

    I want to change the font color of a text field in a table (single cell only) on pressing a key combination. Does anybody know how to do this.
    I have a lot of data in a table. During an evaluation of the data in a meeting I want to change the color of the text depending on the result of the meeting. (for example: High risk = CTRL+R makes the text red).
    I know how to change the color using a button, but I do not want to add a button after each cell. For this reason I would like to do it on a key combination that alway refers to the active cell.
    Many thanks for your help in advance.
    Marcel

    Hi,
    I don't think you can use the ctrl key like that as those shortcuts will be intercepted by Reader (ctrl-R toggles the ruler display on / off).  You also might have trouble updating the color while you still have focus on it.  You can use the shift key in a similar way, so if you only have lower case characters in the text fields then you can do something like;
    if (xfa.event.shift)
        switch (xfa.event.change)
            case "R":
                this.fontColor = "255,0,0";
                break;
            case "O":
                this.fontColor = "255,102,0";
                break;
            case "G":
                this.fontColor = "0,255,0";
                break;
        xfa.event.change = ""; // ignore character
    If you need uppercase characters maybe you can have one button to set "review mode" and test that on the if (xfa.event.shift) line.  But again it wont take effect until you have tabbed out of the field.
    Regards
    Bruce

  • How does APEX check for null values in Text Fields on the forms?

    Hello all,
    How does APEX check for null values in Text Fields on the forms? This might sound trivial but I have a problem with a PL/SQL Validation that I have written.
    I have one select list (P108_CLUSTER_ID) and one Text field (P108_PRIVATE_IP). I made P108_CLUSTER_ID to return null value when nothing is selected and assumed P108_PRIVATE_IP to return null value too when nothign is entered in the text field.
    All that I need is to validate if P108_PRIVATE_IP is entered when a P108_CLUSTER_ID is selected. i.e it is mandatory to enter Private IP when a cluster is seelcted and following is my Pl/SQL code
    Declare
    v_valid boolean;
    Begin
    IF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NULL THEN
    v_valid := TRUE;
    ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NOT NULL THEN
    v_valid := TRUE;
    ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NULL THEN
    v_valid := FALSE;
    ELSIF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NOT NULL THEN
    v_valid := FALSE;
    END IF;
    return v_valid;
    END;
    My problem is it is returning FALSE for all the cases.It works fine in SQL Command though..When I tried to Debug and use Firebug, I found that Text fields are not stored a null by default but as empty strings "" . Now I tried modifying my PL/SQL to check Private_IP against an empty string. But doesn't help. Can someone please tell me how I need to proceed.
    Thanks

    See SQL report for LIKE SEARCH I have just explained how Select list return value works..
    Cheers,
    Hari

  • How do I shut off receiving phone and text messages when I a out of the country but instill want to send and receive emails emails

    How do I shut off receiving phone and text messages when I am out of the country.  I still want to be able to email and receive email on wifi

    Enable Airplane mode followed by turning on wi-fi access.

Maybe you are looking for

  • License for OSX and Windows

    I am interested in purchasing a copy of PSE 9, but I am unsure on the licensing rules. As far as I can ascertain, one can have PSE installed on one notebook and one desktop on the same liscense, assuming only one can be used at any given time. If tha

  • Error while connecting to R/3 system

    Hello All, I am trying to connect BW and R/3 system .I have done all the necessary settings : RFC connections, Defined message types, generated partner profile. Now I am trying to connect to R/3 system through RSA1. I picked up the right target host

  • Cannot install Windows 7 64-bit on IdeaPad U400

    I work for a local tech repair shop.  Yesterday, a customer brought in a Lenovo IdeaPad U400 with a bad hard drive, from which the data was completely unrecoverable.  I replaced it without issue, and it boots to the Windows 7 install disk just fine. 

  • S_P99_41000101 - Check Register Modification to include new fields

    Dear Friends, We are working in 4.7V. The user wants to include new fields in Check Register. Special G/L ind. Demand Draft No GL Code Material Code How to include the new fields and how to match Material code to check no or payment or vendor. Please

  • IPOD Software update and Factory Resetting

    Hey, So my Ipod touch needs to be reset and I cannot load the backup of it back on. If I purchased the iPod touch 3.0 update the first time around, will I have to repurchase it again once it is reset, or will it install it again? Thanks