The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
add data into selectfild with ajax
i have a selectfield:
HTML Code:
<form action="musikcp.php" method="get"> <select name="kategorie"> <option value="1" class="" selected="selected">kategorie1</option> <option value="2" class="" >123</option> <option value="3" class="" >123</option> <option value="4" class="" >mein test</option> <option value="5" class="" >123</option> <option value="6" class="" >23</option> <option value="7" class="" >23</option> </select></form> HTML Code:
<div class="vbmenu_popup" id="neuekat_menu" style="display:none"> <form action="musikcp.php" method="post"> <table width="200px"><tr><td class="alt2">Name: <input type="text" name="katname" /> <input type="hidden" name="do" value="dokat" /> <input type="submit" value="speichern" /></td></tr></table></form> </div> |
#2
|
|||
|
|||
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:
<script> function Test(parm) { if(parm!='') // always check your parameters. { var opt = document.createElement("option"); // create an option object opt.text = parm; // set the text of that object to the text provided document.forms[0].elements['sel'].add(opt); // add it to the end of the select object } else alert("Enter a category first!"); // Or "enterzie einen kategorie bitte" or whatever } </script> Code:
<form> <select name="sel"> <option>First</option> <option>Second</option> <option>Third</option> <option>Fourth</option> <option>Fifth</option> </select> </form> Code:
<form action="javascript:Test(document.forms[1].elements['cat'].value);"> <input name="cat"> <input type="submit"> </form> And if they're going to test it, I don't have to. So there. ;p |
#3
|
||||
|
||||
You have to also keep in mind that not everyone has Javascript enabled.
|
#4
|
|||
|
|||
yes, thats clear
theres a normal method available just the js part is missing |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|