Jump to content

Poulate a option field on change


kusal

Recommended Posts

Hello

 

I have a category select menu, what I want is to when user select a category I have to repopulate the sub category select menu with items

 

can I do this with out AJAX, it does not matter if there is a another request

 

can I use a onchange to call another php function?

Link to comment
Share on other sites

You can do this without using AJAX  ;) ;) ;) ;)

 

There are two ways

 

1. Using form reload

  In this method on change of the combobox will have to reload using the combobox value and fill the sub combo

    >:( >:( Not so good method

 

2. Using javascript

    When you load the page you have to store all the subcategories in a javascript two dimensional array

    and on change of the main combobox you have to fill the sub combobox values by filtering the array of sub  categories

 

one doubt  ??? ???

:o :o :o :o

if you can allow the request you cannt you use ajax  ??? ??? ???

 

Link to comment
Share on other sites

How would Javascript know what the new items were unless you planned to type them all into your Javascript file/tags?

 

It would more likely come from a database source, which will require a request to the server, which will be an AJAX method.

Link to comment
Share on other sites

i dont say you have to hard code the sub category fields

 

on loading the page you have to take it from sub category table and will have to dynamically create a javascritp array  ::) ::)::) ::)

 

And what happens when the data in sub category table changes? This will not update the users array and therefore would cause problems. AJAX is the only way to do this properly.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.