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 August 8th, 2005, 07:36 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default How to write value of checked list in textbox

I have a list of checkboxes that when I check I want it to be written in the textbox. I need a space in between the writing of each checkbox checked.

Code:
   For Each Word In ArrayTemp
   Response.Write "<input type=""checkbox"" value=""" & Trim(ArrayTemp(i)) & """ name=""Keywordh"">" & word & "</br>"
i=i+1
  next
  Response.Write "</br>"

%>
</td>
<%
  rs.MoveNext
loop%></br>
<input size="10" name="Keywordh" value="<%=Request("Keywordh")%>"></br>
<input type="submit" value=" Search " size="100" title="Search everything selected">
</form>
Martial Law 9/11 Rise of the Police State is now available! Visit our Martial Law movie section for complete info (click here), or order now by clicking the button below or by calling 888-253-3139
http://www.infowars.com/martial_law_911.htm
 
Old August 10th, 2005, 04:43 PM
Authorized User
 
Join Date: Aug 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the only way i know of to do this is to use the JavaScript OnChance event handler
i think it would look something like this

<Script Language="Javascript">
Update{
<%
For i = LBound(ArrayTemp) TO UBound(ArrayTemp)
    if Request("chkBox" & i).checked
        String = String & Request("chkBox" & i)
        txtBox.value = String
    end if

%>
}
</Script>


<%
   Dim Word
   Dim String
   For Each Word In ArrayTemp
   Word = Trim(ArrayTemp(i))
%>
<input type="checkbox" name="chkBox<% & i & %>" value="<% & Word & %>" OnChange="Javascript:Update()">
<% & Word & %></br><%
i=i+1
  next
  Response.Write "</br></td>"
  rs.MoveNext
  loop
%>

</br>
<input size="10" name="txtBox" value=""></br>
<input type="submit" value="Search" size="100" title="Search everything selected">
</form>

i am only just learning asp and javascript but i have been programming for a long time. i know there are probabily errors in this code because i havn't adjusted to the syntax yet.
the main errors are gonna be,

name="chkBox<% & i & %>" Request("chkBox" & i).checked
i dont know how you check a checkbox to see if its checked

Request("chkBox" & i)
i'm not sure if this will work for the names of the checkboxes and getting the info back

other than that i think this should work

-----------------------------------------
Inigo: You have a great gift for rhyme.
Fezzik: Yes, yes, some of the time.
Vizzini: Enough of that.
Inigo: Fezzik, are there rocks ahead?
Fezzik: If there are, we'll all be dead.
Vizzini: No more rhymes now, I mean it!
Fezzik: Anybody want a peanut?
 
Old August 10th, 2005, 06:08 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

I have this so far:
Code:
<script language='javascript'>
 function addCheck() {
 document.getElementById('KeywordhText').value = '';
   for (var i = 0; i < document.getElementById('Keywordh').length;i++) {
     if (document.yourForm.Keywordh[i].checked == true) {
         document.getElementById('KeywordhText').value = document.getElementById('KeywordhText').value + document.yourForm.Keywordh[i].value + ' ';
     }
   }
 }
 </script>
 
 <%
    For Each Word In ArrayTemp
    Response.Write "<input type=""checkbox"" value=""" & Trim(ArrayTemp(i)) & """ name=""Keywordh"" onChange=""javascript:addCheck();"">" & word & "</br>"
 i=i+1
   next
   Response.Write "</br>"
 
 %>
 </td>
 <%
   rs.MoveNext
 loop%></br>
<%
Response.Write("<textarea name='""KeywordhText""' rows='3' cols='64'>")
response.write("</textarea></br>")
%>
<%' <input size="10" name="KeywordhText" value="<%=Request("Keywordh")%"></br>%>
 <input type="submit" value=" Search " size="100" title="Search everything selected">
 </form>

First, the checkboxes are words of a broken phrase. WHat I need is that whatever I select it should write in the textarea automatically. It's not doing that. Either the javascript is wrong or the eventhandlers are needed, or both.

Martial Law 9/11 Rise of the Police State is now available! Visit our Martial Law movie section for complete info (click here), or order now by clicking the button below or by calling 888-253-3139
http://www.infowars.com/martial_law_911.htm





Similar Threads
Thread Thread Starter Forum Replies Last Post
checked list box iranp2pcsharp C# 2005 5 July 16th, 2007 11:45 PM
write the values of textbox to a file sandhyamn Pro JSP 1 May 23rd, 2007 10:04 AM
hi help me to write javascript to validate textbox karthikc85 XML 1 October 12th, 2006 03:12 AM
Change Textbox and have checkbox checked arholly Access VBA 1 August 25th, 2006 10:22 AM
Write XML element into textbox with XSLT tcstom XSLT 4 July 5th, 2006 04:08 AM





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