Hey guys so what im trying to achieve here is that the user will enter a page where they can add tracks to an album. The first half of the page is set with 3 text boxes, the album name , year and record company. Now what i want to do is have a drop down box underneath this that will allow the
user the choose the number for tracks they want to add. When they choose for example 5 . Then the page will add 5 input fields with the names
Track 1 , track 2 ect . Im assuming some sort of refresh function should be used or something. Also the one thing i was thinking about is how will the input boxes "name' be stored eg t1? because im going to have to send this info to a second page and insert into a database.Im having difficulty
coming up with the logic to do so.
Any help would be greatly appreciated
Regards
Anu
Help required for adding the correct amount of input fields from drop down box
Started by anurags1932, Sep 10 2011 04:53 PM
1 reply to this topic
#1
Posted 10 September 2011 - 04:53 PM
|
|
|
#2
Posted 27 September 2011 - 12:32 PM
What have you done so far?
Maybe we can help you more if you post the code you have till now.
You can add elements to a page using something like
Using input name that ends with "[]" means that data will be sent in an array, you can also specify a key for that element in the array by adding a key like "file[1]"
Maybe we can help you more if you post the code you have till now.
You can add elements to a page using something like
var howManyToAdd=parseInt(document.getElementById("songsNumber").value);
for(var i=0;i<howManyToAdd;i++)
document.getElementById("songsContainer").innerHTML+="<label>Song No "+(i+1)+"</label><input name='song[]' type='file' />";
Using jQuery you can do:
var howManyToAdd=parseInt(jQuery("#songsNumber").val());
for(var i=0;i<howManyToAdd;i++)
jQuery("<label>Song No "+(i+1)+"</label><input name='song[]' type='file' />").appendTo("songsContainer");
Using input name that ends with "[]" means that data will be sent in an array, you can also specify a key for that element in the array by adding a key like "file[1]"
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









