SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2002
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changing names of input fields

    Okay, I'm trying to create a form out of an input box in a hidden span. The input box is named FNAME_ADD_ and in the function to show the input box, I'm changing the name based on the folder number (eg. FNAME_ADD_1, FNAME_ADD_2, etc). The problem I've encountered is that it changes the name of the hidden text box as well as the new one that it is showing (when the input box is shown, it adds on to the innerHTML of another div, thus allowing me to build up text boxes).

    Is there any way I can show the input box, and change its name without changing the previous instance?

    This only needs to work in IE5+.

    Thanks,
    Joe Fiorini
    -Joe

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2002
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking sweet

    Got it! Sweet!

    Here's the code:

    Code:
    	function AddTextBoxes(){
    		FolderNum++;
    		alert(TextBoxes.innerHTML);
    		tmpHTML = TextBoxes.innerHTML;
    		if(FolderNum > 10){
    			alert("You cannot enter more than 10 folders!");
    			return;
    		}
    		
    		EditButton_ADD_.href = "Javascript:ShowPlainText(" + FolderNum + ", null, \"ADD_\")";
    
    		FNAME_ADD_.id = "FNAME_ADD_"  +  FolderNum;
    		FNAME_ADD_.name = "FNAME_ADD_"  +  FolderNum;
    		sFNAME_ADD_.id = "sFNAME_ADD_"  +  FolderNum;
    		EditButton_ADD_.id = "EditButton_ADD_" + FolderNum;
    		DeleteButton_ADD_.id = "DeleteButton_ADD_" + FolderNum;
    		NewTextBoxes.innerHTML += TextBoxes.innerHTML;
    		TextBoxes.innerHTML = tmpHTML;
    		alert(NewTextBoxes.innerHTML);
    	}
    -Joe

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2002
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy

    Except now I can't get the FNAME_ADD_.name to change when I do FNAME_ADD_.name = 'whatever'.

    Grr...

    Later,
    Joe
    Last edited by jfiorini; May 29, 2002 at 13:23.
    -Joe


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •