View Single Post
  #8 (permalink)  
Old 04-11-2008, 01:35 PM
Pcm Pcm is offline
Newbie
 
Join Date: Apr 2008
Posts: 5
Credits: 0
Rep Power: 0
Pcm is on a distinguished road
Default Re: Javascript to Add a Text Input field

Hi There:

Thanks for your response: It's almost what I need,

But if entries are made one time to the form and the "Add erase button" is clicked, then I would like the first entries the user inputs to be save in the form field, but then the exact same form is displayed again below that and the fields are blank, so that the user can fill it in again with new inputs.

Does this make sense?

Here is an exact example of the form i'm working with so you may get a better idea of what it needs to do..... again Thanks for your help:


Code:
<%

	i1 = 1
	isDone = vbFalse
	set rsChildren = Server.CreateObject("ADODB.Recordset")
	y = getDocumentChildren(rsChildren, documentId, RELATIONSHIPTYPEID_SPOTLIGHT)

	while not isDone
		if rsChildren.eof then
			isDone = vbTrue
			documentRelationshipId = -1
			tabTitle = ""
			childDocumentId = -1
			featureTitle = ""
			featureDek = ""
			suffix = CStr(i1)
		else		
			documentRelationshipId = rsChildren("DOCUMENT_RELATIONSHIP_ID")
			tabTitle = rsChildren("TAG_TEXT")
			childDocumentId = rsChildren("CHILD_DOCUMENT_ID")
			featureTitle = rsChildren("DOCUMENT_TITLE")
			featureDek = rsChildren("DEK")
			suffix = CStr(i1)
		end if
%>
			
			
         <input type="hidden" name="<%=QUERYSTRING_PARMNAME_CHILDDOCUMENTID%><%=suffix%>" id="<%=QUERYSTRING_PARMNAME_CHILDDOCUMENTID%><%=suffix%>" value="<%=childDocumentId%>"/>
        <input type="hidden" name="documentRelationshipId<%=suffix%>" id="documentRelationshipId<%=suffix%>" value="<%=documentRelationshipId%>"/>
		<input type="hidden" name="<%=QUERYSTRING_PARMNAME_RELATIONSHIPTYPEID%><%=suffix%>" id="<%=QUERYSTRING_PARMNAME_RELATIONSHIPTYPEID%><%=suffix%>" value="<%=RELATIONSHIPTYPEID_SPOTLIGHT%>"/>
			  <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" WIDTH="50%">
           <TR>
            <TD CLASS="label_top_beige" WIDTH="116">Tab Title:</TD>
            <TD><INPUT TYPE="Text" NAME="tabTitle<%=suffix%>" id="tabTitle<%=suffix%>" size="94" value="<%=tabTitle%>"></TD>
          </TR>
		  <TR>
            <TD CLASS="label_top_beige" WIDTH="116">Copy Title:</TD>
            <TD><INPUT TYPE="Text" NAME="copyTitle<%=suffix%>" id="copyTitle<%=suffix%>" size="94" value="<%=featureTitle%>">
            </TD>
          </TR>
          <tr>
            <td class="label_top_beige" width="116" "<%=leftCellWidth%>">Introduction Copy:</td>
            <td><textarea name="introductionCopy<%=suffix%>" id="introductionCopy<%=suffix%>" cols="90"><%=featureDek%></textarea></td>
          </tr>
        </TABLE>
		 <br />
        <table>
  
          <tr>
            <td><table>
                <tr>
                  <td width="131" class="sectionhead"><a name="bmkRelationships" class="sectionlink" id="bmkRelationships">Search for winner </a> </td>
              <%
		if childDocumentId > 0 then
			editRelationshipsURL = "related_content.asp?" & QUERYSTRING_PARMNAME_DOCUMENT_ID & "=" & childDocumentId
			editRelationshipsURL = editRelationshipsURL & "&backToId=" & documentId
%>
				  <td align="right" class="sectionhead" style="font-size:xx-small" width="300">  
				  <a href="<%=editRelationshipsURL%>" >Edit</a>
				   &nbsp;|&nbsp; 
				   <a href="#" onclick="javascript:this.innerHTML = toggleDisplay('divRelationships');">Hide</a> | 
				   <a href="updatedisplayorder.asp?DISPLAY_ORDER_UPDATE_TYPE=DOCUMENT_RELATIONSHIP&amp;<%=QUERYSTRING_PARMNAME_DOCUMENT_ID%>=<%=Request(QUERYSTRING_PARMNAME_DOCUMENT_ID)%>">Update Display Order Numbers</a> </td>
                </tr>
                <tr>
                  <td colspan="2"><img src="images/beigedot.gif" border="0" width="100%" height="1" /> </td>
                </tr>
              </table>
              <div id="divRelationships" name="divRelationships" style="display:block">
   <%
		DOCUMENTRELATIONSHIPSINLUDE_DOCUMENTID = childDocumentId
		DOCUMENTRELATIONSHIPSINLUDE_INCLUDECHILDREN = -1
		DOCUMENTRELATIONSHIPSINLUDE_INCLUDEPARENTS = 0
%>
              <!-- #include file="includes/document_relationships.inc" -->
              </div></td>
          </tr>
        </table>
		       <%
			end if
			if not isDone then
				rsChildren.movenext
				i1 = i1 + 1
				if rsChildren.eof then
					isDone = vbTrue
				end if
			end if
		wend
		rsChildren.close
		set rsChildren = nothing
%>		
		<br />
		<table align="right">
          <tr>
            <td> <a class="sectionlink" href="#" onclick="javascript:validateAndSubmit();">Save Winner</a>
        &nbsp;|&nbsp;
			<input name="count" type="hidden" id="count" value="(val)+1;"/> 
			<input name="Add another" type="submit" value="Add another" id="Add" onclick="submitForm('add')"/>
            </td>
          </tr>
        </table>
Reply With Quote