If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Field names (might be silly)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-01-06, 11:01
igordonin igordonin is offline
Registered User
 
Join Date: Jul 2006
Posts: 56
Field names (might be silly)

Hi, guys!

Here's my issue


I have a dynamic form table that creates rows based on a query result. So... Better to check it out:

Code:
...

<%
	objRS.open SQL, objConn
		if (objRS.eof) then
%>
            <tr>
              <td colspan="4" class="GreenTahoma11Bold">
                <div align="center" style="padding: 2px 0px 2px 0px; "> No records found. </div></td>
            </tr>
<% 
		else 
%>

            <tr>
              <td class="BlackTahoma11"><div style="padding: 2px 0px 0px 2px; "> Paying Options </div></td>
              <td align="center" class="BlackTahoma11">Ammount (R$) </td>
              <td class="BlackTahoma11"><div align="center">Change (R$) </div></td>
              <td class="BlackTahoma11">&nbsp;</td>
            </tr>
            <!--#include file="includes/color_switch_invert.inc"--> <% 'just to alternate the td bgcolors between white and lightgrey %>


<%
			do until (objRS.eof)
%>

            <tr bgcolor="<%= color %>">
              <td width="160" class="BlackTahoma11">
                <div style="padding: 2px 0px 2px 2px; "> <%= objRS("desc_payment_opt") %> </div></td>
              <td width="80"><div align="center">
                  <input name="ammount" id="ammount" type="text" class="Input40" value="<%= fixMoney(objRS("ammount")) %>" onBlur="newAmmount(<%= objRS("id") %>, this.value);">
				  
              </div></td>
              <td width="90"><div align="center">
                  <input name="change" id="change" type="text" class="Input40" value="<%= fixMoney(objRS("change")) %>" onBlur="newChange(<%= objRS("id") %>,this.value);">
              </div></td>

			  <td width="208">
                <div align="right" style="padding: 2px 2px 0px 0px; "> 
				  <a href="javascript:void(0)"><img src="images/icon_v.jpg" alt="New Ammount" width="16" height="16" border="0"></a>
				  <a href="goto.asp?act=del&sid=<%= objRS("id") %>" target="_parent" ><img src="images/icon_x.jpg" alt="Delete Payment Choice" width="16" height="16" border="0"></a>
				</div>
			  </td>
            </tr>

<%
				objRS.movenext
%>

<!--#include file="includes/color_switch_do.inc"-->

<%
			loop
		end if
	objRS.close
'====================================================================================
%>

          </table>
Ok, now what I want is simple. I want to dynamically focus on the "ammount" field. So, if my query returns only one record, I'm fine. But if returns more than one, there will be more than one "ammount" fields.

That means that something like document.form.ammount.focus(); will generate a script error.

I thought that they would automaticcaly be named ammount[i] or something, but they are not...

Can anybody help me?

Sorry about my poor English, and any help would be appreciated.
Reply With Quote
  #2 (permalink)  
Old 08-01-06, 18:06
igordonin igordonin is offline
Registered User
 
Join Date: Jul 2006
Posts: 56
got it

Well...

I guess this should be in a JavaScript forum...

Anyways, I used the getElementById() to solve the problem.

Dunno if this could help anybody, but if it can, lemme know and I'll show how I came around.

Cheers
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On