Forums

REVISED: Search / Smoothbox / Getting there...

demo38 16 Apr, 2009
Good Morning,
OK, please note than I'm a hack at heart...

Joomla 1.5.10 / ChronoForms_V3.1_RC4.11 / WAMP Server

Been trying to implement the Smoothbox here: http://www.chronoengine.com/forums.html?cont=posts&f=12&t=12019
And the Search example here: http://www.chronoengine.com/forums.html?cont=posts&f=12&t=11737&st=0&sk=t&sd=a&start=15#p21937

I have the following set up:

Where
<?php
$search_array = array('document', 'publication', 'author');
$where = array();
foreach ( $search_array as $search ) {
  $value = JRequest::getVar($search, '' , 'post');
  if ( $value ) {
    $where[] = " $search LIKE '$value%' ";
  }
}
if ( !empty($where) ) {
  echo " WHERE ".implode(' AND ', $where);
}?>


Header
<div style="float:left"><b>Search KHC Documents Database.</b></div><div style="float:left">
<b>Document/Publication/Author</b>: <input type="text" name="undefined"><input type="submit" value="Search" name="undefined" style='width:80px; color:#cccccc; background-color:#222222; cursor:pointer;' /></div>
<br /><br />


Documents listed alphabetically:
<br />
<table style="text-align: left; width: 600px;" border="0" cellpadding="2" cellspacing="0">
  <tbody>
    <tr>
      <td style="font-weight: bold; width: 5%;">#</td>
      <td style="font-weight: bold; width: 30%;">Document</td>
      <td style="font-weight: bold; width: 25%;">Author</td>
      <td style="font-weight: bold; width: 25%;">Publication</td>
      <td style="font-weight: bold; width: 15%;">Year</td>
    </tr>
  </tbody>
</table>
<div class="clr" style="border-bottom: 3px solid #222; padding: 3px; margin-bottom: 10px;"></div>


Body
    <p class="blocknumber">
    <span class="bignumber">
<table style="text-align: left; width: 650px;" border="0" cellpadding="2" cellspacing="0">
  <tbody>
    <tr>
	  <td style="font-weight: bold; width: 32%;"><?php echo sprintf('%02s', (1 + $counter)); ?></span><a class="smoothbox" name="<b>KHC Document Review</b> - {document}" href="#TB_inline?height=400&width=500&inlineId=cccontent_{id}_box" id="cccontent_{id}"   >    {document}</a></td>
      <td style="width: 23%;">{author}</td>
      <td style="width: 23%;">{publication}</td>
      <td style="width: 7%;">{year}</td>
      <td style="width: 20%;">{delete_record} / {edit_record}</td>
    </tr>
  </tbody>
</table></p>
    <div id="cccontent_{id}_box" style="display: none;">
<br><br>
<b>Document Name</b>: {document}<br>
<b>Author</b>: {author}<br>
<b>Publisher</b>: {publication}<br>
<b>Year</b>: {year}<br><br>
<b>File</b>: {fileupload}<br><br>
<b>URL</b>: {website}<br><br>
<b>Researched?</b> {radio3}<br>
<b>Peer Reviewed?</b> {radio4}<br><br>
<b>Description</b>: {description}<br><br>
<b>Notes</b>: {notes}<br><br>
<b>Categories</b>: {check2}
</div>
<hr color="#f2f2f2">


The display is dead-on what I need on the frontend, but the issues I'm having are...

1.) When displaying the data inside of the smoothbox pop-up, it's displaying the wrong data??? instead of pulling the data from the table for each item. For instance, the document name is correct in the header of the pop-up, it pulls that for each item, but the other data associated with that item is wrong. 🤨

- SOLVED BELOW - 2.) The links inside the smoothbox pop-up are not active links. How would I make that happen? So that the URL links would be a live URL links, and the file links (to PDFs, DOCs, ZIPs) would link you to the file associated?

3.) For {new_record}, I've tried to link to add the same form as attached, including bringing in the script tags / links to the css and javascript files pulled from the view source of the actual document submit form page. I would like to have the {add_record} function identically to the actual form (then I wouldn't need the other). It looks the same, but it doesn't validate any of the required items, and the data doesn't save to the database?

4.) For {delete_record}, is there a way to prompt for confirmation before actually deleting the record? Clicking by accident could be an issue.

- SOLVED BELOW - 5.) The Search item isn't working, but I'm a little unclear how to fix it. In the array, I understand that I need to list out the fields that I would like to search, but how do I get it to actually search those fields on Submit? Right now, I click Submit and nothing happens, the page just reloads with all data shown. *PARTIAL EDIT* Realized that the search will return items if i set it back to only search {document} for instance, and only if I start typing the first few letters, it won't return any results if it's a search for a second word in a title for instance. So a search for "Dog" will return "Dogma and Goat Cheese", but not "Goat Cheese and Dogma".

6.) I see filtering in the General Tab, but don't know how this works? Ability to allow users to sort the columns? That would be great if that's an option?


Thanks for any help!
-Jonathon
demo38 16 Apr, 2009
Just noticed as well that when using {add_record} in the above scenario, the file that gets uploaded does not get renamed with the timestamp?

Basically, none of the checks and balances are working...

Any thoughts?

Thanks,
J
demo38 16 Apr, 2009
Another realization, on the ChronoForms form for adding the documents, I have validation enabled, but it's not validating the URL, it accepts even one letter for some reason?

Thanks,
J
GreyHead 17 Apr, 2009
Hi demo,

I can see an error message in FireBug

missing ] in index expression
[Break on this error] cfvalidate_text_0.add( Validate.Format, ... fMessage_val_validate_validate_url } );

which links back to the url validation around line 53 in JSvalidation2.php but I can't see exactly what the bug is - hopefully that will give Max a place to start from and hunt it down.

Bob
demo38 17 Apr, 2009
Thanks for posting that, any insight on the other topics? I'm sorry to throw so much in one post, but once working I would be more than happy to share the working setup for a document database if anyone would like it (thanks to all the help on the forums here). The above items would finish off the functionality to make this a working beast!

Thanks,
J
GreyHead 17 Apr, 2009
Hi demo38,

Sorry - I haven't been able to look at any of the other questions so far. I know that it's messy getting forms into lightboxes and making sure that the links with Joomla still work. If I have time over the weekend I'l take a look but I fear it's not a five minute question - could easily be an hour or six to sort all that through.

Bob
demo38 20 Apr, 2009
I don't mean to be a pest, just psyched up to see this thing working in ChronoForms.

OK, number 5 the one about Searching is solved, editing this line in the WHERE section took care of searching inside of strings, by adding the extra wild card.

    $where[] = " $search LIKE '%$value%' ";


Some of the others seem like they will be ChronoConnectivity specific / related...

Will keep plugging away! Any help is appreciated,

Thanks,
J
demo38 22 Apr, 2009
- SOLVED - 2.) The links inside the smoothbox pop-up are not active links. How would I make that happen? So that the URL links would be a live URL links, and the file links (to PDFs, DOCs, ZIPs) would link you to the file associated?

This was a matter of adding the html links inside of the BODY area using the record variables within them. In my case, this is as follows:

<b>File</b>: <a href="components/com_chronocontact/uploads/KHCDocuments/{fileupload}">Download File</a><br><br>
<b>URL</b>: <a href="http://{website}" target="_blank">Website Link</a>
demo38 22 Apr, 2009
Bob / Max / PHP gurus,

Would you please assist me with figuring this one out?

1.) When displaying the data inside of the smoothbox pop-up, it's displaying the wrong data??? Instead of pulling the data from the table for each item. For instance, the document name is correct in the header of the pop-up, it pulls that for each item, but the other data associated with that item is wrong.🤨



For some reason, when any of the items are clicked on from the initial list, the id number for that particular item seemingly isn't getting passed along with that selection. So, the pop-up launches, the header label is correct showing the CORRECT selected document name, but all of the other data in the pop-up is displaying the information from the first record in the list. Even after a search which could return 5 items, no matter which item selected in that shortened list, it returns the info for the first record in that shortened list. I've spent hours tweaking to no avail...

Thanks for any insight!
Jonathon
demo38 23 Apr, 2009
Newest code, adding more search options...

WHERE SQL:
<?php
$search_array = array('document', 'publication', 'author', 'year', 'description', 'notes', 'check2');
$where = array();
foreach ( $search_array as $search ) {
  $value = JRequest::getVar($search, '' , 'post');
  if ( $value ) {
    $where[] = " $search LIKE '%$value%' ";
  }
}
if ( !empty($where) ) {
  echo " WHERE ".implode(' AND ', $where);
}?>


HEADER
<div style="float:left"><b><a href="index.php?option=com_chronocontact&chronoformname=KHCDocuments">Add New Document</a> | Search KHC Documents Database.</b></div><div style="float:left">
<table style="text-align: left; width: 650px;" border="0" cellpadding="2" cellspacing="0">
  <tbody>
    <tr>
      <td style="font-weight: bold;">Document</td>
      <td style="font-weight: bold;">Author</td>
      <td style="font-weight: bold;">Publication</td>
      <td style="font-weight: bold;">Year</td>
    </tr>
    <tr>
      <td><input class="cf_inputbox" title="" type="text" id="text_1" name="document"></td>
      <td><input class="cf_inputbox" title="" type="text" id="text_3" name="author"></td>
      <td><input class="cf_inputbox" title="" type="text" id="text_2" name="publication"></td>
      <td><div class="form_element cf_dropdown">
<select class="cf_inputbox validate-selection" id="select" size="1" title="" name="year">
<option value="">Select Year</option>
<option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
</select>   
</div></td>
    </tr>
    <tr>
      <td style="font-weight: bold;">Description</td>
      <td style="font-weight: bold;">Notes</td>
      <td style="font-weight: bold;">Categories</td>
    </tr>
    <tr>
      <td><input class="cf_inputbox" type="text" id="text_9" name="description"></td>
      <td><input class="cf_inputbox" type="text" id="text_10" name="notes"></td>
      <td><div class="form_element cf_dropdown">
<select class="cf_inputbox validate-selection" id="select" size="1" title="" name="check2">
<option value="">Choose Option</option>
<option value="cardiology">Cardiology</option>
<option value="ob gyn">OB-GYN</option>
<option value="best practice">Best Practice</option>
<option value="surgery">Surgery</option>
<option value="neuro">Neuro</option>
<option value="Womens Study">Women's Study</option>
<option value="pharmacy">Pharmacy</option>
<option value="psychiatric">Psychiatric</option>
<option value="icu">ICU</option>
<option value="ambulatory">Ambulatory</option>
<option value="nicu">NICU</option>
<option value="radiology">Radiology</option>
<option value="womens">Women's</option>
<option value="presentation">Presentation</option>
<option value="med surg unit">Med Surg Unit</option>
<option value="anesthesiology">Anesthesiology</option>
<option value="oncology">Oncology</option>
<option value="inpatients">Inpatients</option>
<option value="leed">Leed</option>
<option value="lab">Lab</option>
<option value="endo">Endo</option>
<option value="rehab">Rehab</option>
<option value="pediatric">Pediatric</option>
<option value="projects">Projects</option>
<option value="trauma">Trauma</option>
<option value="urgent care">Urgent Care</option>
<option value="lean">Lean</option>
<option value="dietary">Dietary</option>
<option value="ortho">Ortho</option>
<option value="mat mang">Mat Mang</option>
<option value="technology">Technology</option>
<option value="ebd">EBD</option>
</select>   
</div></td>
    </tr>
  </tbody>
</table>

<input type="submit" value="Search / Reset" name="undefined" style='width:100px; height:22px; color:#f2f2f2; border:0; background-color:#333333; cursor:pointer;' /><br>
</div>
<br /><br />


Please Note: Documents listed alphabetically.
<br />
<table style="text-align: left; width: 600px;" border="0" cellpadding="2" cellspacing="0">
  <tbody>
    <tr>
      <td style="font-weight: bold; width: 5%;">#</td>
      <td style="font-weight: bold; width: 30%;">Document</td>
      <td style="font-weight: bold; width: 25%;">Author</td>
      <td style="font-weight: bold; width: 25%;">Publication</td>
      <td style="font-weight: bold; width: 15%;">Year</td>
    </tr>
  </tbody>
</table>
<div class="clr" style="border-bottom: 3px solid #222; padding: 3px; margin-bottom: 10px;"></div>


BODY
    <p class="blocknumber">
    <span class="bignumber">
<table style="text-align: left; width: 650px;" border="0" cellpadding="2" cellspacing="0">
  <tbody>
    <tr>
	  <td style="font-weight: bold; width: 32%;"><?php echo sprintf('%02s', (1 + $counter)); ?></span><a class="smoothbox" name="<b>KHC Document Review</b> - {document}" href="#TB_inline?height=400&width=500&inlineId=cccontent_{id}_box" id="cccontent_{id}"   >    {document}</a></td>
      <td style="width: 23%;">{author}</td>
      <td style="width: 23%;">{publication}</td>
      <td style="width: 7%;">{year}</td>
      <td style="width: 20%;">{delete_record}|{edit_record}</td>
    </tr>
  </tbody>
</table></p>
    <div id="cccontent_{id}_box" style="display: none;">
<br><br>

<b>Document Name</b>: {document}<br>
<b>Author</b>: {author}<br>
<b>Publisher</b>: {publication}<br>
<b>Year</b>: {year}<br><br>
<b>File</b>: <a href="components/com_chronocontact/uploads/KHCDocuments/{fileupload}">Download File</a><br><br>
<b>URL</b>: <a href="http://{website}" target="_blank">Website Link</a><br><br>
<b>Researched?</b> {radio3}<br>
<b>Peer Reviewed?</b> {radio4}<br><br>
<b>Description</b>: {description}<br><br>
<b>Notes</b>: {notes}<br><br>
<b>Categories</b>: {check2}
</div>
<hr color="#f2f2f2">



Thanks,
Jonathon
demo38 24 Apr, 2009
Any thoughts on the data displaying wrong items?

I'm getting a Firebug error as follows?

$(ed.getProperty("id") + "_tip") is null
(?)()()chronoco...umentList (line 562)
(?)()()chronoco...umentList (line 561)
returns()()mootools.js (line 21)
returns()(undefined)mootools.js (line 21)
cloneEvents()(function())mootools.js (line 50)
cloneEvents()("domready", undefined, undefined)mootools.js (line 50)
parse()()mootools.js (line 59)
returns()()mootools.js (line 21)
returns()(DOMContentLoaded )mootools.js (line 21)
[Break on this error] var Tips3 = new Tips(ed, $(ed.getProp...p').getText(), {elementid:'xxxxxxxxx'});



Does this help decipher at all???
Thanks!
J
GreyHead 25 Apr, 2009
Hi Jonathon,

The first line looks as though it's checking for an input with an id of field_name_tip and not finding it. Not certain though.

Bob
purple knight 25 Apr, 2009
Hi all, this looks like a problem that I have with my smoothbox. There's a summary table of results posted by guests. The table works fine. However, as I click the link for more details, the content inside the smoothbox is totally incorrect. Hmmm... but after reading through the entire thread, I am still unsure to solve this little bug problem... 😶
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount

{item:title} {images:#}