Results 1 to 3 of 3

Thread: Changing Form Elements

  1. #1
    Join Date
    Jul 2010
    Thanked 0 Times in 0 Posts

    Default Changing Form Elements

    This isn't exactly what I need it for, but let's suppose I have a form where I ask the user to rate his favorite movies of the year. To help him, I've listed my top 10, with a dropdown box beside each one allowing him to choose one of the rating options. So far, so good.

    But now I know that he might like some movies that are not in my top 10. So "in the background," I've got a list of all the movies that came out this year. I want to give him a field that he can start typing in and as he types it compares what he's typing to the list and assists him in finding the film of his choice. Perhaps (though not necessarily) like the Google search box that displays a running list of options...

    Once the user finds the movie he wanted, that title is somehow added to the form and the user can now rate it. That means (perhaps) that a new field (with the new title) and a new dropdown box are dynamically added to the form...and I can then later read that information to retrieve it and store it.

    For bonus points, perhaps I can give them the ability to add several new movies / fields / dropdowns.

    Does such a thing already exist? Something similar that can be modded? (Knowing that I'm not a JavaScript-enabled person...)

    Thank you!


  2. #2
    Join Date
    Mar 2006
    Illinois, USA
    Thanked 690 Times in 678 Posts


    First, take this one step at a time. Each step is possible, but you will probably need to modify and combine several existing scripts (and perhaps write some parts yourself).

    Here are some ideas to begin:
    1. Look at address forms that allow you to select the country then dynamically create the "state" dropdown menu or whatever is relevant for that country. Find a tutorial for this, and try to use some of the ideas.

    2. In order to fill in the text as the user types, you will need to use Ajax and a serverside script (PHP?) that will find the closest title, though programming that might be hard in itself. You could actually store all the possible films in Javascript and skip Ajax, but that might be slow for the user if there are hundreds of titles.

    3. To create a multiple action like this, you will need to build a repeatable function that does all of the above. And it may be best to use an array style field, like name="myfilm[]" so that you don't need to worry about the exact number.

    This is not a simple project, but it's possible. If you have time to take it slowly and work out the details, you can probably do it. If not, you might want to hire someone, such as if you need this soon.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jul 2008
    Derbyshire, UK
    Thanked 599 Times in 575 Posts
    Blog Entries


    This might suit your needs for point 2 of Daniel's breakdown:


Posting Permissions

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