Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_ado_rds thread: How to display currency format


Message #1 by leonwpk@n... on Sun, 24 Feb 2002 01:47:15 -0500
Hi:

I hope you might be able to help me.  I wrote a web script to read records from an access database using RDS.  So far all the data
are dutifully displayed on the page.  The only problem I have now is:



One of the fields is a Currency field.  When the data is displayed in the binded Span and Input elements, the number displays
without any comma delimiter or any currency symbol.  I checked the table: the data is stored with commas and dollar symbol.



When I save a record I format the html form element value first using FormatCurrency(frm.txtCurrency.value,2).  But the displayed
record in the span line still does not display the symbols and commas.  And when I refresh the records and check to see, the same -
no commas



 I managed to convert to currency format and display into another text field.    This I do in the Windows_onload.  



Sub Window_OnLoad()

  objDC.ExecuteOptions = adcExecSync

  objDC.FetchOptions = adcFetchUpFront

  objDC.Connect = "DSN=Citibank"

  objDC.Server = "http://<%=Request.ServerVariables("SERVER_NAME")%>"

  DoSelect

  objDC.Refresh

   If objDC.Recordset.EOF = True Then

   msgbox("There is no record.  To add a new record, please click on the '+' button")

 End If

 test = objDC.Recordset("PALAmount")

 frm.test.value = formatcurrency(test)

End Sub



However as I click on a binded row 



<TD nowrap width="250px">$<SPAN datafld="PALamount"></SPAN></TD>



to display a record, the text field above the table having the currency format is not changed.



<TR>

      <TD class=ColumnLabel>PAL Amount</TD>

      <TD><INPUT ID="txtPALAmount" dataFld=PALAmount dataSrc=#objDC>

      </TD><td><input type="Text" name="test"></td>

      <td></td>

      </TR>



I'm using this javascript to get the current row in the binded table:



<SCRIPT FOR=trTemplate EVENT=onclick Language="JavaScript">

   objDC.recordset.AbsolutePosition = this.recordNumber;

   window.event.cancelBubble = true; // don't bother bubbling to the document

   tbl.rows[objDC.recordset.AbsolutePosition].style.backgroundColor = 'orange';

</SCRIPT>



I tried using the lines inside the above javascript, but no go:



tst = objDC.Recordset("PALAmount")

document.frm.test.value = FormatCurrency(tst,2)



And, also, another related problem is how to display the currency format in the SPAN element.



Please help.



Thanks

Leon

-- 

HP:  xxx xxx xxxx









__________________________________________________________________

Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@N...!
http://shopnow.netscape.com/



Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/




  Return to Index