Results 1 to 9 of 9

Thread: adding/removing items manually from 2 level interdependent lists

  1. #1
    Join Date
    Feb 2013

    adding/removing items manually from 2 level interdependent lists

    I found similar topics and some are similar but not exactly to what I want to do.

    From a 2 level interdependent select list, I want the user to be able to add/modify/remove items.

    Something similar to what is in here;


    Any help will be greatly appreciated!

  2. #2
    Join Date
    Mar 2009
    Wherever i lay my hat
    I did this a while ago, see if it does something similar to what you want to achieve:


  3. #3
    Join Date
    Feb 2013
    Apologies for my lack of explanation

    I want to have 2 select fields. The one on the left is supposed to have parent categories and the one on the right child categories. Just as in the URL I posted.

    The thing is, I want the user to be able to add/modify/delete parent and child categories from text fields and buttons. Here is a sample image so that everyone can get an idea.


    Uploaded with ImageShack.us
    I know it is too much to ask. I've done that in the past pulling categories from databases but never with variables

  4. #4
    Join Date
    Mar 2009
    Wherever i lay my hat
    Well, the bottom comboboxes had that parent-child relationship. I removed the listboxes with arrows and made the comboboxes with size=10. The options text in #cb0 are the keys to the goasData object. I made it global, so you can add the Add/Rename/Remove functionality, however these values will be reset after page refresh. The line:

    D.ev( window, "load", hLoad );

    just says that the function hLoad should be called after all the elements are loaded. I was too lazy to write element.addEventListener(), document.getElementById() and such, so i made the global object D, which has shortcuts for some commonly used functions. In the hLoad function, there's again just one listener for #cb0 change, which calls changeOptions(). There the magic with dynamic fill happens; i'm sure it's not hard to understand.

    I think you can build atop of this. If you don't like my D object, you don't have to use it. Maybe you'd want to use some jQuery to spare your keyboard, i don't know. Try something yourself and i can help you further.

  5. #5
    Join Date
    Oct 2010
    Versailles, France
    See, for example, this link Changing Select element content on the fly

  6. #6
    Join Date
    Feb 2013
    Haulin: The thing is that in the sample you provided, values are already set and I want to make exactly the same thing but with values that the user inserts from an input field.
    As you can see I am not very experienced with Javascipt. I will try to use some of your code and get it to work to what I want to do. Thank you for providing the sample!

    007Julien: I found exactly the same link yesterday. Again, I thought that sample already contained set values. I will take a look again.

    On the other hand, I was thinking using a hash table instead. Would that be better?

  7. #7
    Join Date
    Mar 2009
    Wherever i lay my hat

    I am sorry, i forgot the attachment last time. Here are the changes, that i was talking about...

  8. #8
    Join Date
    Feb 2013


    Thank you for the file.
    As you can assume I am a beginner in javascript but I can read and understand your code.
    The problem is that I want to add the values just like in your code but from an input field.

    Suppose the user opnes the html file and both boxes are empty. Then the user starts populating from input fields and and an add/delete button.

    I can do that if slect menus were independent but as there is a parent/child select menu I don't know how to relate them. I was thinking of making dummy slect menus, put the values there and call the child options whenever the user calls them by clicking on the parent option from the parent select menu but I do not know how I can append them.

  9. #9
    Join Date
    Mar 2009
    Wherever i lay my hat
    Well, the JS part is easy for me, but i don't want to invent your UI. Forget my sample. Do the HTML part with some styling, use appropriate captions for buttons, text input fields, position it, so it would be clear, which element belongs to which group... You know, make it look how you want it (maybe sth like in the pic in post #3) and i will breathe the life into it

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.11126 seconds
  • Memory Usage 2,929KB
  • Queries Executed 16 (?)
More Information
Template Usage (32):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (9)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • fetch_postattach_query
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates