how to get a form field by clicking on a URL
Moderator: General Moderators
-
dream2rule
- Forum Contributor
- Posts: 109
- Joined: Wed Jun 13, 2007 5:07 am
how to get a form field by clicking on a URL
http://i97.photobucket.com/albums/l202/ ... gement.jpg
In the above form, when i click onto add another file link, i want to display a new browse field.
How do i do that?
Can this be done using PHP?
Regards,
Dream2rule
feyd | We don't need a 150K image
In the above form, when i click onto add another file link, i want to display a new browse field.
How do i do that?
Can this be done using PHP?
Regards,
Dream2rule
feyd | We don't need a 150K image
-
dream2rule
- Forum Contributor
- Posts: 109
- Joined: Wed Jun 13, 2007 5:07 am
-
dream2rule
- Forum Contributor
- Posts: 109
- Joined: Wed Jun 13, 2007 5:07 am
- miramardesign
- Forum Newbie
- Posts: 3
- Joined: Fri Jun 29, 2007 7:36 pm
- Location: Miami and Hollywood FL
- Contact:
url button via css
The easy way is just to make a form button and then style it like it is a regular link via css. Re-color the background , take out the border etc. I don't think you can get it perfect perfect to loook like a link but pretty damn close the only noticable thing I had when I did this is that the url depressed/moved when active because its really a button.
you should have a javascript function that replaces the innerHtml attribute of a div each time the "add" button is pressed.
some thing like this:
i don't know if this is the best way, but try it.
i don't know if the fields get reset after calling this function... if this happens, you sould make a backup of the values and then put them in the new inputs.
some thing like this:
Code: Select all
var count = 1;
function addBrowseField(containerDiv) {
var html = "";
var i;
for(i = 0; i < count; i++) {
html += '<input type="file" name="file' + i + '">';
}
containerDiv.innerHtml = html;
count++;
}i don't know if the fields get reset after calling this function... if this happens, you sould make a backup of the values and then put them in the new inputs.
-
dream2rule
- Forum Contributor
- Posts: 109
- Joined: Wed Jun 13, 2007 5:07 am
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Yeah, the "best way" (or "proper way") is creating the elements and appending them, but the innerHTML property was the only property invented by Microsoft that actually proved useful.martinco wrote:i don't know if this is the best way, but try it.
It's just a matter of accessing those elements later on.
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
martinco wrote:i think i understand what you say, but... can you post a script that does that?superdezign wrote:the "best way" (or "proper way") is creating the elements and appending them
Code: Select all
function addNewField(obj)
{
if(typeof(obj) != 'Object') obj = document.getElementById(obj);
var newField = document.createElement('input');
newField.name = 'file[]';
newField.type = 'file';
obj.appendChild(newField);
}- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm