Page 1 of 5 123 ... LastLast
Results 1 to 15 of 62
  1. #1
    Join Date
    Jul 2004
    Posts
    494

    Unanswered: 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.ru.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 Attached Files

  2. #2
    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.

  3. #3
    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:

    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.ru.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 Attached Files

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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?

  5. #5
    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.

  6. #6
    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

  7. #7
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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

  8. #8
    Join Date
    Jul 2004
    Posts
    494

    i think so but which space?

    I've been trying to figure this out for hours!

  9. #9
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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')

  10. #10
    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.

  11. #11
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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.

  12. #12
    Join Date
    Jul 2004
    Posts
    494

    should I restart my computer?

    Should I restart my computer?
    Attached Files Attached Files

  13. #13
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    first thing I would suggest is changing your browser caching rules.... set it to always check for a new version

  14. #14
    Join Date
    Jul 2004
    Posts
    494

    where?

    I guess it's tools-internet option-

  15. #15
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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 Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •