[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Dynamic Jump Menu with autocomplete not passing info in URL

Posted on 2007-10-09
4
Medium Priority
?
290 Views
Last Modified: 2013-12-13
I am having difficulty  with a dynamic jump menu i am using in DWCS3. The problem is the page won't process the new page with the id I am trying to pass through. I am using an autocomplete behavior and a script that shortens the display text, but I can't seem to get the actually jumping part to work in the menu. I removed the action from the form just because i had no idea where to process it. I feel like I need to edit the onchange() function, but not sure to what. Basically, I have a DB dynamically filling the menu with all the listings I have, and I want to be able to start typing in a search, have it autocomplete the text, and jump to the listings page with the category ("cat") id passed through the url.  The script i have so far is :


<form id="formsearch" name="formsearch" method="post" action="#">
     
      <label for="jumpMenu">search for listing</label>
   
     <select name="jumpMenu" id="jumpMenu" class="autoconvert" onchange="MM_jumpMenu('parent',this,0)" style="width:110px;">
   
 <?php
do {  
?>

       <option value="<?php echo $row_rsListingAll['listing_id'] ?>">
        
          <a href="listings.php?cat=<?php echo $row_rsListingAll['listing_category_id']; ?>">  

<?php       $short_search = $row_rsListingAll['listing_title'];
                              
                              if(strlen($short_search) > 15)
                              {
                              $totalChars = 15;
                              $short_search = substr($short_search,0,$totalChars)."...";
                              }
            
            echo $short_search ?>

       </a>

       </option>
       
        <?php
} while ($row_rsListingAll = mysql_fetch_assoc($rsListingAll));
  $rows = mysql_num_rows($rsListingAll);
  if($rows > 0) {
      mysql_data_seek($rsListingAll, 0);
        $row_rsListingAll = mysql_fetch_assoc($rsListingAll);
  }
?>
      </select>
     
       
      </form>
0
Comment
Question by:digiblis
  • 3
4 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 750 total points
ID: 20046491
Hi digiblis,

I'm a little confused by your option code.  It looks like your doing too much there and the wrong value is being passed to the mm_jumpMenu.

Try something like this instead:

<option value="listings.php?cat=<?php echo $row_rsListingAll['listing_category_id'] ?>">
<?php       $short_search = $row_rsListingAll['listing_title'];
                             
                              if(strlen($short_search) > 15)
                              {
                              $totalChars = 15;
                              $short_search = substr($short_search,0,$totalChars)."...";
                              }
           
            echo $short_search ?>
</option>

The main fix is to pass both the page and query string through mm_jumpMenu.  However, if you have been futzing with the DW generated code, it may to remove it and start over.  It's twitchy that way.

J
0
 

Author Comment

by:digiblis
ID: 20049374
thanks very much. simple and effective.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 20050662
You're welcome!
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 20050687
Just out of curiosity, what would have made this an A answer?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month18 days, 2 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question