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 > how to use recordType in htm/asp

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-10-04, 14:05
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
how to use recordType in htm/asp

What I have is a table which one of the 10 fields is called "recordType".

I have in my htm two radio buttons for enabling/disabling 66 checkboxes. So far that works.

But the 66 checkboxes all have "value="recordType"" and name=recordType names. The names are listed:

Code:
<SCRIPT LANGUAGE=Javascript>
     
  function disable(OnOff) {
  var f = kjbible;
 
	f.gn.disabled=OnOff;
	f.is.disabled=OnOff;
	f.ro.disabled=OnOff;

	f.ex.disabled=OnOff;
	f.je.disabled=OnOff;
	f.co.disabled=OnOff;

	f.lv.disabled=OnOff;
	f.la.disabled=OnOff;
	f.ci.disabled=OnOff;

	f.nu.disabled=OnOff;
	f.ez.disabled=OnOff;
	f.ga.disabled=OnOff;
      
	f.de.disabled=OnOff;
	f.da.disabled=OnOff;
	f.ep.disabled=OnOff;


	f.js.disabled=OnOff;
	f.ho.disabled=OnOff;
	f.ph.disabled=OnOff;


	f.jg.disabled=OnOff;
	f.jl.disabled=OnOff;
	f.cl.disabled=OnOff;


	f****.disabled=OnOff;
	f.am.disabled=OnOff;
	f.th.disabled=OnOff;


	f.sa.disabled=OnOff;
	f.ob.disabled=OnOff;
	f.te.disabled=OnOff;

	f.sm.disabled=OnOff;
	f.jh.disabled=OnOff;
	f.ti.disabled=OnOff;

	f.ki.disabled=OnOff;
	f.mi.disabled=OnOff;
	f.tm.disabled=OnOff;


	f.kn.disabled=OnOff;
	f.na.disabled=OnOff;
	f.tt.disabled=OnOff;


	f.ch.disabled=OnOff;
	f.hb.disabled=OnOff;
	f.pl.disabled=OnOff;

	f.cr.disabled=OnOff;
	f.ze.disabled=OnOff;
	f.he.disabled=OnOff;

	f.ea.disabled=OnOff;
	f.ha.disabled=OnOff;
	f.ja.disabled=OnOff;

	f.ne.disabled=OnOff;
	f.zc.disabled=OnOff;
	f.pe.disabled=OnOff;	

	f.es.disabled=OnOff;
	f.ml.disabled=OnOff;
	f.pt.disabled=OnOff;

	f.jb.disabled=OnOff;
	f.mt.disabled=OnOff;
	f.jn.disabled=OnOff;	

	f.ps.disabled=OnOff;
	f.mk.disabled=OnOff;
	f.jnn.disabled=OnOff;

	f.pr.disabled=OnOff;
	f.lk.disabled=OnOff;
	f.jhn.disabled=OnOff;


	f.ec.disabled=OnOff;
	f.jo.disabled=OnOff;
	f.ju.disabled=OnOff;


	f.so.disabled=OnOff;
	f.ac.disabled=OnOff;
	f.re.disabled=OnOff;

}
</SCRIPT>
Example:
Code:
 
    <td width="33%" height="19">  
<input TYPE="checkbox" NAME="gn" CHECKED VALUE="recordType">Genesis</td>
<td width="33%" height="19">
<input TYPE="checkbox" NAME="is" CHECKED VALUE="recordType">Isaiah</td>
<td width="33%" height="19">
<input TYPE="checkbox" NAME="ro" CHECKED VALUE="recordType">Romans</td>
  </tr>
My goal is to check some of the checkboxes (after enabling the checkbox table through the radio buttons) and search a keyword in that range(s) only. Example. Above are three names gn, is, ro. If I select "gn" only I want the keyword to be searched in the "gn" records ONLY. Or if I select "gn" and "is" only I want the keyword to be searched in the "gn" and "is" records ONLY.

I have attached my htm and asp pages with a small portion of my database if you want to verify.
Attached Files
File Type: zip amos.zip (2.9 KB, 9 views)
File Type: zip kjv.zip (17.0 KB, 16 views)
Reply With Quote
  #2 (permalink)  
Old 08-10-04, 20:00
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
You have that backwards. The checkbox tags should be name="recordType" and value="gn" (and so on and so forth)...
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #3 (permalink)  
Old 08-10-04, 21:56
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
I had that switched but how would that work?

I thought there may have been a misunderstanding so I switched it. The enabling/disabling worked. But now that I switched back, clicking on the radio button says:

Quote:
line: 61
Error: 'gn' is null or not an object
I had changed the 66:

Code:
<SCRIPT LANGUAGE=Javascript>
     
  function disable(OnOff) {
  var f = kjbible;
 
	f.gn.disabled=OnOff;
	f.is.disabled=OnOff;
	f.ro.disabled=OnOff;

	f.ex.disabled=OnOff;
	f.je.disabled=OnOff;
	f.co.disabled=OnOff;

	f.lv.disabled=OnOff;
	f.la.disabled=OnOff;
	f.ci.disabled=OnOff;

	f.nu.disabled=OnOff;
	f.ez.disabled=OnOff;
	f.ga.disabled=OnOff;
      
	f.de.disabled=OnOff;
	f.da.disabled=OnOff;
	f.ep.disabled=OnOff;


	f.js.disabled=OnOff;
	f.ho.disabled=OnOff;
	f.ph.disabled=OnOff;


	f.jg.disabled=OnOff;
	f.jl.disabled=OnOff;
	f.cl.disabled=OnOff;


	f****.disabled=OnOff;
	f.am.disabled=OnOff;
	f.th.disabled=OnOff;


	f.sa.disabled=OnOff;
	f.ob.disabled=OnOff;
	f.te.disabled=OnOff;

	f.sm.disabled=OnOff;
	f.jh.disabled=OnOff;
	f.ti.disabled=OnOff;

	f.ki.disabled=OnOff;
	f.mi.disabled=OnOff;
	f.tm.disabled=OnOff;


	f.kn.disabled=OnOff;
	f.na.disabled=OnOff;
	f.tt.disabled=OnOff;


	f.ch.disabled=OnOff;
	f.hb.disabled=OnOff;
	f.pl.disabled=OnOff;

	f.cr.disabled=OnOff;
	f.ze.disabled=OnOff;
	f.he.disabled=OnOff;

	f.ea.disabled=OnOff;
	f.ha.disabled=OnOff;
	f.ja.disabled=OnOff;

	f.ne.disabled=OnOff;
	f.zc.disabled=OnOff;
	f.pe.disabled=OnOff;	

	f.es.disabled=OnOff;
	f.ml.disabled=OnOff;
	f.pt.disabled=OnOff;

	f.jb.disabled=OnOff;
	f.mt.disabled=OnOff;
	f.jn.disabled=OnOff;	

	f.ps.disabled=OnOff;
	f.mk.disabled=OnOff;
	f.jnn.disabled=OnOff;

	f.pr.disabled=OnOff;
	f.lk.disabled=OnOff;
	f.jhn.disabled=OnOff;


	f.ec.disabled=OnOff;
	f.jo.disabled=OnOff;
	f.ju.disabled=OnOff;


	f.so.disabled=OnOff;
	f.ac.disabled=OnOff;
	f.re.disabled=OnOff;

}
</SCRIPT>
And put
Code:
f.recordType.disabled=OnOff;
Instead but that didn't work either.

Help me. I don't know how the flow is supposed to go.
Attached Files
File Type: zip amos.zip (19.9 KB, 14 views)
Reply With Quote
  #4 (permalink)  
Old 08-11-04, 02:05
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Okie, I have looked at this page but I'm not sure what you are trying to do.

Currently if you change the radio button you enable or disable the check boxes... cool...

I assume you are trying to get this information passed in a useful way to the amos page?? yes?
Reply With Quote
  #5 (permalink)  
Old 08-11-04, 13:15
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
how to disable some by enabling other?

For some reason this doesn't work entirely:
See note at the end.


Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>Search for the Bible</title>
<script language="javascript">
function EnableDisable()
{
    if(document.kjbible.optAction[0].checked)
        for(i=0;i<document.kjbible.recordType.length;i++)
            document.kjbible.recordType[i].disabled=true;
    if(document.kjbible.optAction[0].checked)
        for(i=0;i<document.kjbible.book.length;i++)
            document.kjbible.book[i].disabled=false;
    if(document.kjbible.optAction[0].checked)
        for(i=0;i<document.kjbible.book_spoke.length;i++)
            document.kjbible.book_spoke[i].disabled=false;
    if(document.kjbible.optAction[0].checked)
        for(i=0;i<document.kjbible.book_title.length;i++)
            document.kjbible.book_title[i].disabled=false;
    
    if(document.kjbible.optAction[1].checked)
        for(i=0;i<document.kjbible.recordType.length;i++)
            document.kjbible.recordType[i].disabled=false;
   if(document.kjbible.optAction[0].checked)
        for(i=0;i<document.kjbible.book.length;i++)
            document.kjbible.book[i].disabled=true;
    if(document.kjbible.optAction[0].checked)
        for(i=0;i<document.kjbible.book_spoke.length;i++)
            document.kjbible.book_spoke[i].disabled=true;
    if(document.kjbible.optAction[0].checked)
        for(i=0;i<document.kjbible.book_title.length;i++)
            document.kjbible.book_title[i].disabled=true;
}

</script>
</head>
<body Onload="Javascript:EnableDisable();">
<fieldset>
<legend>
Biblewheel:
</legend>
<tr>
<form name="kjbible" action="amos.asp" method="get">
Search for:
<input type="text" name="Keyword">
<input type="submit" value="Submit"><input type="reset">
</td>
    <br>
    <input type="radio" name="optAction" CHECKED onclick="Javascript:EnableDisable();">Enable The entire King James Bible 
    <input type="radio" name="optAction" onclick="javascript:EnableDisable();">Disable Your selection of books
    <br>

<br>
<input type="checkbox" name="book" VALUE="yes">
Book
<br>
<input type="checkbox" name="book_spoke" VALUE="yes">
Book Spoke
<br>
<input type="checkbox" name="book_title" VALUE="yes">
Book Title
<br>
<input type="checkbox" name="chapter" VALUE="yes">
Chapter
<br>
<input type="checkbox" name="chapter_spoke" VALUE="yes">
Chapter Spoke
<br>
<input type="checkbox" name="verse" VALUE="yes">
Verse
<br>
<input type="checkbox" name="verse_spoke" VALUE="yes">
Verse Spoke
<br>
<input type="checkbox" name="text_data" VALUE="yes">
Text
 </tr>
 <fieldset>
<legend>
Search:
</legend>

     <p>Where do you want to search?</p> 
    <table border="1" width="100%" height="500">
  <tr>
    <td width="33%" height="19">  
<input TYPE="checkbox" NAME="recordType" VALUE="gn" CHECKED >Genesis</td>
<td width="33%" height="19">
<input TYPE="checkbox" NAME="recordType" VALUE="is" CHECKED >Isaiah</td>
<td width="33%" height="19">
<input TYPE="checkbox" NAME="recordType" VALUE="ro" CHECKED >Romans</td>
  </tr>
  <tr>
    <td width="33%" height="19">  
<input TYPE="checkbox" NAME="recordType" VALUE="ex" >Exodus</td>
<td width="33%" height="19">
<input TYPE="checkbox" NAME="recordType" VALUE="je" >Jeremiah</td>
<td width="33%" height="19">
<input TYPE="checkbox" NAME="recordType" VALUE="co" >1 Corinthians</td>
  </tr>
 </table>
</fieldset>
</form>
</fieldset>
</body>
</html>


I don't think I can change those three names into one name because each represents a field in database table.
Reply With Quote
  #6 (permalink)  
Old 08-11-04, 17:21
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
1.
Code:
SELECT * FROM bible WHERE text_data LIKE '%adam%' OR ( recordType = 'gn' AND recordType = ' is' AND recordType = ' ro')
Searches the entire table of the database

2.
Code:
SELECT * FROM bible WHERE text_data LIKE '%adam%' AND ( recordType = 'gn' AND recordType = ' is' AND recordType = ' ro')
"We did not find a match!"

3.
Code:
SELECT * FROM bible WHERE text_data LIKE '%adam%' AND ( recordType = 'gn' OR recordType = ' is' OR recordType = ' ro')
Searches the first recordType only

4.
Code:
SELECT * FROM bible WHERE text_data LIKE '%adam%' OR ( recordType = 'gn' OR recordType = ' is' OR recordType = ' ro')
Displays every record found in the 1st recordType, then searches for the keyword in the rest of the table.

I don't understand why.

How can I eliminate the spaces between ' and is in ' is' and ' ro' ?

Code:
For iLoopCount = 0 To UBound(aRecTypes)
      If iLoopCount <> 0 Then
        SQL = SQL & " OR "
      End If

      SQL = SQL & " recordType = '" & aRecTypes(iLoopCount) & "'"
    Next
  End If

  SQL = SQL & ")"
End If

Response.Write SQL
Reply With Quote
  #7 (permalink)  
Old 08-11-04, 19:01
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
okie, 3 is the correct option... why it is only returning matches on the first record type is another problem.... the sql you are using is correct, I suspect the spaces in the other record types are causing your problem.

To remove the spaces use the trim command... so you would have something like...
Code:
For iLoopCount = 0 To UBound(aRecTypes)
      If iLoopCount <> 0 Then
        SQL = SQL & " OR "
      End If

      SQL = SQL & " recordType = '" & trim(aRecTypes(iLoopCount)) & "'"
    Next
  End If

  SQL = SQL & ")"
End If

Response.Write SQL
hth
Reply With Quote
  #8 (permalink)  
Old 08-11-04, 19:06
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
i think so but which space?

I've been trying to figure this out for hours!
Reply With Quote
  #9 (permalink)  
Old 08-11-04, 19:10
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
this space... (shown now as an underscore)
Code:
SELECT * FROM bible WHERE text_data LIKE '%adam%' AND ( recordType = 'gn' OR recordType = '_is' OR recordType = '_ro')
Reply With Quote
  #10 (permalink)  
Old 08-11-04, 19:13
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
must be in the code which I put

It can't be in the htm because it always shows spaced in the second and consecutive ones.

Code:
SQL = SQL & " recordType = '" & trim(aRecTypes(iLoopCount)) & "'"
My guess would be the bold part but I've tried eliminating spaces but didn't work.
Reply With Quote
  #11 (permalink)  
Old 08-11-04, 19:17
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
My guess would be that you are either working with a cached version of your page again or there is something else in there... maybe what is displaying as a space is actually a tab.

attach the page that generates the sql and I'll fix it.
Reply With Quote
  #12 (permalink)  
Old 08-11-04, 19:22
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
should I restart my computer?

Should I restart my computer?
Attached Files
File Type: txt amos.txt (3.9 KB, 38 views)
Reply With Quote
  #13 (permalink)  
Old 08-11-04, 19:27
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
first thing I would suggest is changing your browser caching rules.... set it to always check for a new version
Reply With Quote
  #14 (permalink)  
Old 08-11-04, 19:34
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
where?

I guess it's tools-internet option-
Reply With Quote
  #15 (permalink)  
Old 08-11-04, 19:34
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
okie, a working page without spaces is attached.

the trim where I said fixed the problem.

please note that in this page I have changed the method of conencting to the database so that it is similar to bible5.asp that I helped you with eariler...
Attached Files
File Type: txt amos.txt (4.1 KB, 36 views)
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