Results 1 to 4 of 4

Thread: [RESOLVED] [Javascript] ComboBox (textbox and select in one)

  1. #1

    Thread Starter
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    Resolved [RESOLVED] [Javascript] ComboBox (textbox and select in one)

    How do I go about it?

    I need Ideas.

  2. #2
    Fanatic Member kaihirst's Avatar
    Join Date
    Jul 2005
    Location
    The Resaurant At the End of The Universe
    Posts
    633

    Re: [Javascript] ComboBox (textbox and select in one)

    Hi,

    you cant do this in javascript as if you try adn write to the document using any kind of document write format, itll throw a method operator error.

    Hees the one I wrote for a project. uses ASP and simple VBscript.

    HTML Code:
    <SELECT id="Tools" style="WIDTH: 116px;" name="tools">
    <option value="" SELECTED>Select and Add</option>
    <option value="None">Nothing</option>
    <OPTION value="Microwave">Microwave</OPTION>
    <option value="Toaster">Toaster Oven</option>
    <option value="Coffee">Coffee Pot</option>
    <option value="Skillett">Electric Skillet</option>
    <option value="Demo Table">Demo Table</option>
    <option value="Military Access">Military Access</option></SELECT>
    
    <input name="ADD_T" type="submit" value="Add>>" />
    <TEXTAREA id="Tools" style="WIDTH: 176px; HEIGHT: 45px" name="ToolBox" rows="2" cols="19"><% call ToolsDisplay() %></TEXTAREA>

    so youve got a select box, submit button and text box to stor the info

    now heres the function to write the info.

    VB Code:
    1. session("Tools") = Request.Form("ToolBox") // textarea form element
    2.  
    3. private function ToolsDisplay()
    4.    
    5. // if the form is submitted and button is not pressed, code wwrites the //session contents into the textarea, errorhandling  code for form
    6. // kickbacks
    7. if (Request.form("ADD_T") = "") then
    8. with response
    9. .write Session.contents("Tools")
    10. end with
    11. end if
    12.  
    13.  
    14. // writes the current selection of the select box
    15. if (Request.Form("ADD_T") <> "") then
    16. with response
    17. .write Request.Form("tools")
    18. end with
    19. end if
    20.  
    21. end function

    This code will write th ecurent selection of the select box into the textarea
    when pressed, adn when other parts of the form are working, suhch as
    a primary submit button, the textarea will show the current session contents, which is collected form the text are when a value is written into the textare.

    Therefore this creates a loop where if a person selects 1 set of data, then goes back and select another
    the data will be collated rather than overritten.

    Its a nice bit of code, althouh a tad convaluted, but neccesssary for optimal performance.

    Hope it helps

    Kai
    As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..

    A few things that make a good Developer a Great One.
    Methodical and a thorough approach to research and design inevitably leads to success.
    Forward thinking is the key to Flow of control.
    Never test in the design environment, always test in real time, you get the REAL results.
    CBSE & OOSE are the same animal, they just require different techniques, and thinking.
    SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them.
    The key to good design is explicit attention to both detail and response.
    Think Freely out of the "Box" you're in..... You will soar to better heights.

    Kai Hirst - MSCE, MCDBA, MCSD, MCP, MCAP, MSCT


  3. #3

    Thread Starter
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    Re: [Javascript] ComboBox (textbox and select in one)

    thanks kai, though not what i need now already ehehehe, specs changes

  4. #4
    Fanatic Member kaihirst's Avatar
    Join Date
    Jul 2005
    Location
    The Resaurant At the End of The Universe
    Posts
    633

    Re: [RESOLVED] [Javascript] ComboBox (textbox and select in one)

    OMG!!!!

    Its a classic when that happens!!!

    Wll.. you knwo for next time if you need it. Also

    You can use the document.myform.submit() on the on change function in javascript for this if anybodies interested. But this might be confusing to your users as they might think on adding manually..

    Kai
    As the information I give is useful in its nature, consider using the RATE POST feature located on the bottom left of this post please..

    A few things that make a good Developer a Great One.
    Methodical and a thorough approach to research and design inevitably leads to success.
    Forward thinking is the key to Flow of control.
    Never test in the design environment, always test in real time, you get the REAL results.
    CBSE & OOSE are the same animal, they just require different techniques, and thinking.
    SEO is a globe of objectives, SE rankings is an end to a means for these objectives, not part of them.
    The key to good design is explicit attention to both detail and response.
    Think Freely out of the "Box" you're in..... You will soar to better heights.

    Kai Hirst - MSCE, MCDBA, MCSD, MCP, MCAP, MSCT


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width