Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 12th, 2004, 01:26 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default putting the values in the text box

I want to record history rate of a person. I have an employee
whose ID=743. I have to record his employee rate from the database table.
  Do while not objHistoryRate.EOF
    if iEmpID="743" then
    strdt1 =objHistoryRate.Fields("dtRateFrom")
    strdt2=objHistoryRate.Fields("dtRateTo")
    strHourlyRate =objHistoryRate.Fields("decHourlyRate")
    end if

    objHistoryRate.MoveNext()
    loop
    <input disabled="text" name="txtdate1" value='<%=strdt1%>'>
  <input disabled="text" name="txtdate2" value='<%=strdt2%>'>
  <input disabled="text" name="txtRate1" value='<%=strhourlyRate% >'>+"</br>"
<input disabled="text" name="txtdate3" value='<%=strdt1%>'>
<input disabled="text" name="txtdate4" value='<%=strdt2%>'>
<input disabled="text" name="txtRate2" value='<%=strHourlyRate%>'>



 
Old October 12th, 2004, 01:31 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hello,

You want <input type='text', not <input disable='text'.

Brian
 
Old October 12th, 2004, 01:32 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Oh, and you have

value='<%=strhourlyRate% >'>+"</br>"

which should be:

value='<%=strhourlyRate %>'><br>
 
Old October 14th, 2004, 09:21 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This question is same as before, But Initially I was hard cording
But I dont have to hard cord. I want to put text boxes values from
the database and add an extra text box where the user can write values to it after hitting save new button and new button should disappear and save button should show up. If the user hits save button. It should be saved in the database and should return the same page. Right Know I am stuck up here. Please look at this code and gives me an error expected end.
 Do while not objHistoryRate.EOF
     'ctr = ctr +1
     ' sub dataEntry()
           dateFrom = cstr(convNull(objHistoryRate("dtRateFrom")))
           dateUntil = cstr(convNull(objHistoryRate("dtRateTo")))
           HourlyRate = cstr(convNull(objHistoryRate("decHourlyRate")))
           strGrid = strGrid + " <TD><INPUT type=""text"" size=15 id=txtdateFrom name=txtdateFrom value='"+ dateFrom + "' ></TD>"
         strGrid = strGrid + " <TD><INPUT type=""text"" size=15 id=txtdateUntil name=txtdateUntil value='"+ dateUntil+ "'></TD>"
         strGrid = strGrid + " <TD><INPUT type=""text"" size=15 id=txtHourlyRate name=txtHourlyRate value='"+ HourlyRate + "'></TD>"
        if objHistoryRate.AbsolutePosition mod 20 = 0 then
              Response.Flush
        end if
         objHistoryRate.MoveNext()
         recCount = recCount + 1
    loop
    Response.Write(strGrid)
Rate History of :
<Input disabled="text" name="txtName" id=txtName value='<%=strName%>'>

 <script language = javascript>
  function callMe(){
  document.thisForm.submit()
  }
 </script>

 <script language = javascript>
  function callUs(){
  var dtFrom1=document.thisForm.txtdate1.value;
  var dtRate=document.thisForm.txtRate1.value;

   if (!(ValidateDate(dtFrom1, 1))){
        alert("invalid date");
        document.thisForm.button1.disabled=false;
        return false;
        }
   }
  </script>





 <input type = "submit" value=New onclick="javascript:callMe();">
 <Input type = "button" value=Save onclick="javascript:thisForm.txtMode.value='C';cal lUs();" name=button1 >
 <Input type = "hidden" name =txtMode>

</BODY>
</HTML>
</FORM>


 
Old October 14th, 2004, 10:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

The only thing I see requiring an end is this:

 if objHistoryRate.AbsolutePosition mod 20 = 0 then
              Response.Flush
        end if


And that looks OK. Is there any other parts to the code for this file? It has to be up higher. Typically, even though it says right around that area, the actual error could be somewhere else (maybe in the beginning).

I also see a sub ' sub dataEntry(), but you have that commented out, so it isn't looking for an end there...

Brian
 
Old October 14th, 2004, 02:37 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey guys. I have two buttons named "new" and "save".
When the user hits "new" three text boxes should appear
at the top of the prevoius one, and at the same time "new"
button should disappear and the "save" should appear and if
the user hits save button once the user enters the values in
the text boxes. It should be saved in the database. and should
return the same asp page. I am trying to write this way but I dont
know how to put the text boxes on the top when I hit "new" and returns
the same page in which new button is disappeared.
 strGrid= "<table border=1><tr>"

Do while not objHistoryRate.EOF

    dateFrom = cstr(convNull(objHistoryRate("dtRateFrom")))
    dateUntil= cstr(convNull(objHistoryRate("dtRateTo")))
    HourlyRate=cstr(convNull(objHistoryRate("decHourly Rate")))
    strGrid =strGrid+ " <TD><INPUT type=""text"" size=15 id=txtdateFrom name=txtdateFrom value='"+ dateFrom + "' ></TD>"
    strGrid =strGrid+ " <TD><INPUT type=""text"" size=15 id=txtdateUntil name=txtdateUntil value='"+ dateUntil+ "'></TD>"
    strGrid =strGrid+ " <TD><INPUT type=""text"" size=15 id=txtHourlyRate name=txtHourlyRate value='"+ HourlyRate + "'></TD></TR>"
    objHistoryRate.MoveNext()
    recCount = recCount + 1
loop
strGrid = strGrid + "</Tr></TABLE>"
Response.Write(strGrid)


function convNull(str)
    if isNull(str) then
        convNull = ""
    else
        convNull = str
    end if
end function

if Request.Form("txtMode")="A" then %>
 <input type = "txt" index=0 name="txtName">
 <input type = "txt" index=0 name ="txtLName">
 <input type = "txt" index=0 name ="txtK">
 <%end if







 <script language = javascript>
  function callMe(){

  document.thisForm.submit()
  }
 </script>

 <script language = javascript>
  function callUs(){
  var dtFrom1=document.thisForm.txtdate1.value;
  var dtRate=document.thisForm.txtRate1.value;

   if (!(ValidateDate(dtFrom1, 1))){
        alert("invalid date");
        document.thisForm.button1.disabled=false;
        return false;
        }
   }
  </script>





 <input type = "submit" value=New onclick="javascript:thisForm.txtMode.value='A';cal lMe();">

 <Input type = "button" value=Save onclick="javascript:thisForm.txtMode.value='C';cal lUs();" name=button1 >
 <Input type = "hidden" name =txtMode>

</BODY>
</HTML>
</FORM>






Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab Values From List Box into Text Box phungleon VB How-To 2 June 19th, 2008 10:33 PM
Text box values are different shoakat Classic ASP Databases 2 April 28th, 2005 12:29 AM
loop values and text box values move mateenmohd Classic ASP Basics 2 April 5th, 2005 11:33 PM
How to get values of a text box from one page to NitinJoshi General .NET 3 January 6th, 2005 06:30 AM
Getting text box values between forms? cdnamm BOOK: Professional C#, 2nd and 3rd Editions 1 August 13th, 2003 11:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.