bit of a quandry here..

well, i’m back on the support again, refining it yet again. This time i’m working on the public side. I have a page that’ll pull up all the user’s tickets. Right now, when they click on the topic, it opens on a seperate page. but what what we want to happen is when they click on the topic, have it open on top of the page, instead of in a seperate window.

If i could have the window or area open to start with, i could do this with straight ajax, but i don’t want the div to be visible when they enter the page, and i want it hidden after they submit the update.

This is the code so far (no js so far)
[php]

<?php require 'config.php'; function truncate($string, $length = '', $replacement = '...', $start = 100) { if(strlen ($string) <= $start) return $string; if($length) { return substr_replace($string, $replacement, $start, $length); } else { return substr_replace($string, $replacement, $start); } } function ConvertDate($sql_date) { $date=strtotime($sql_date); $final_date=date("m-d-Y", $date); return $final_date; } $id = $_COOKIE['user']; $query = mysql_query("SELECT * FROM venzo_contactus WHERE email = '$id' ORDER BY createdon DESC") or die(mysql_error()); $numrows = mysql_num_rows($query); if($numrows == 0) { echo "
No Tickets were found at this time
"; } else { echo "
My Tickets
"; ?>
					<!-- display ticket window -->
					<div style="width: 930px; margin: 0 auto; padding-top: 10px; ">

					</div>
					<div style="width: 930px; margin: 0 auto; padding-top: 10px;">
						<table cellpadding="2" cellspacing="1" border="0" style="width: 100%; font-size: 12px;">
							<tr>
								<td style="text-align: center;">Req ID</td>
								<td style="text-align: center;">Status</td>
								<td style="text-align: center;">Submitted On</td>
								<td style="text-align: center;">Topic</td>
								<td style="text-align: center;">Answered by</td>
								<td style="text-align: center;">Updated On</td>
							</tr>
							<?php 
							$date = date("Y-m-d");
							$CurDate = strtotime($date);
							$yesterday = strtotime("-1 day", $CurDate);
							
							for($i = 0; $i < $numrows; $i++) {
								$r = mysql_fetch_array($query);
								$compare = strtotime($r['date']);
								
								if($compare > $yesterday) {
									$new = "<span style='color: red;'>$r[req_id]</span>";
								} else {
									$new = $r['req_id'];
								}
								
								if($r['status'] == 0) {
									$status = "Answered";
								} else if($r['status'] == 1) {
									$status = "On Hold";
								} else if($r['status'] == 2) {
									$status = "New";
								} else if($r['status'] == 3) {
									$status = "A.C.R";
								} else if($r['status'] == 4) {
									$status = "Closed";
								}
								
								if($r['subject'] == "") {
									$r['subject'] = "Test";
								}
								
								if($r['last_answered_by'] == "") {
									$ans = "<span style='color: red;'>Open</span>";
								} else {
									$ans = $r['last_answered_by'];
								}
								
								if($i % 2) {
									echo "<tr bgcolor='#FFE6CC'>\n";
								} else {
									echo "<tr bgcolor='white'>\n";
								}
								
								if(empty($r['last_answered_by'])) {
									$ans = "";
								} else {
									$val = explode(', ', $r['last_answered_by']);
									$ans = end($val);
								}
							?>
								<td style="width: 30px; padding-right: 10px; text-align: left;"><?php echo $new; ?></td>
								<td style="width: 40px; padding-right: 10px; text-align: center;"><?php echo $status; ?></td>
								<td style="width: 140px; padding-right: 10px; text-align: center;"><?php echo $r['createdon'] ?></td>
								<td><a href="http://vmg.venzodigital.com/public_check_inquiries.php?req_id=<?= $r['req_id']?>" target="_tab" ><?php echo truncate(stripslashes($r['subject'])); ?></a></td>
								<td style="width: 120px;"><?php echo $ans; ?></td>
								<td style="width: 140px; text-align:center;"><?php echo $r['date'] ?></td>
							</tr>
							<?php } ?>
						</table>
					</div>
<?php } ?>[/php]

any thoughts or ideas would be greatly appreciated.

Just use Javascript to set the style of the DIV to not be visible.

Something like this might work for you…

<script>
function showDiv() {
  [DIV].style.visibility='visible';
  //or something
  }
function hideDiv() {
     [DIV].style.visibility='hidden';
     //or something
  }  

I don’t do much with JS, so not sure about the DIV parts… But, a start for you…

The quandry is how to get the data to the form. I use a query on the other page to pull the information. Unless it could be done in 3 seperate steps. open the window or div, load the data/form. then collapse the div again.

Okay, do you mean you want to load data behind the scenes and then build the display and then make it visible?

If so, same way… If you load something into an INVISIBLE DIV, the data is still there, just not displayed on the screen. So, load it up. Alter the fields however. Then, show it off…

Try some test, doesn’t have to be with live data, anything… And, let us know what problems you have.

I have loaded two videos, showing one, one invisible. Then, loaded a new video inside the player and switched them. One visible one hidden. Seems to work with ANY data in a DIV… Example, you can load a bunch of fields or textarea, invisible, load data into the text area and fields, drop-downs and then make visible. Is that what you are talking about??

Kinda. the problem is that the data only appears after the link is clicked, so there’s nothing to pre-load, although, could i go ahead and pre-load the form, then use ajax to fill in the information after the link is clicked?

Well, I didn’t see a link and do not have the data, so really wasn’t sure what you were doing.

You can load a PHP page dynamically into a hidden iFrame or non-visible DIV. Not being visible, you can do any type of call to load it with options set by session variables or in arguments. Then, read the fields that are loaded by the PHP page and do calculations and move to the visible field areas…

I think that would work for you…

The link is on the bottom

<a href="http://vmg.venzodigital.com/public_check_inquiries.php?req_id=<?= $r['req_id']?>" target="_tab" ><?php echo truncate(stripslashes($r['subject'])); ?>

Though i may just change that to a button to, then i use the same code that i used for the answer templates. Might be easier too.

Yes, that would be easier! Lots of other options, but, simpler is usually best… LOL…

Anyway, let me know if you what to try another way…

I got it working, but not like what i wanted. I ended up having to use a popup box. Really defeats the purpose of doing it, but my boss is happy with it, that’s all that counts :slight_smile: Also found some really nifty code for doing rounded corners purely using js (not niftycorners lol).

LOL , ALWAYS nice when the boss is happy!

Perhaps you should do a small tutorial on rounded-corner. Sounds like you have a good way to do them!

The corners work, but for whatever reason, when i put the code on the back-end, it only pulls 1 request id. I’ll post it when i get home, i know its trying to give me a heart attack lol.

as for tutorial, i didn’t write the code, i got it off of javascriptsource.com

i got it working. I can’t believe what missing quotes in the url and the placement of the actual script will do. Had to place the jscript at the bottom of the page and change the link to . i was missing the single quotes around the php stuff.

LOL, always the little things… Congrat’s on finding it. CYA in the bitstream…

Sponsor our Newsletter | Privacy Policy | Terms of Service