View Full Version : add data into selectfild with ajax
i have a selectfield:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
and a form:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
how can i add the new cat wich i input throu the form to the select part without reloading the site?
CDarklock
16 Sep 2007, 02:06
You need to use JavaScript for this, but it's not really obvious how to do it. Here's a barebones set of code that works.
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
This code assumes the FIRST form in your document has a select element named "sel":
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
The second form in your document in turn has an action calling the desired function with the appropriate parameter:
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------
I have only tested this code in IE7... because now that I've said that, everyone with Firefox and Opera will immediately run off and test it in their browser, hoping it will break and make Microsoft look bad. If they don't start ringing bells and waving flags and crowing about the flaws of IE, it works in everything.
And if they're going to test it, I don't have to. So there. ;p
Dismounted
16 Sep 2007, 09:39
You have to also keep in mind that not everyone has Javascript enabled.
yes, thats clear
theres a normal method available
just the js part is missing
vBulletin® v3.6.12, Copyright ©2000-2009, Jelsoft Enterprises Ltd.