JasonLewis Posted August 17, 2010 Share Posted August 17, 2010 Try using elm.value, like this: if(elm.value == ''){ // fade out }else{ // show suggetions } Hope it's all nearly working. Quote Link to comment Share on other sites More sharing options...
billy_111 Posted August 17, 2010 Author Share Posted August 17, 2010 Woohoo! Yep that worked. Just to be picky, there is one final thing, because i have position:relative on the div wrapping the suggestive text, it is making it appear below the "Current" textbox, this is fine when a user is adding one author, then the second and third etc.. But.. Let's say someone comes along and clicks on "Add author" 6 times because they need to add 6 authors and start typing in the first one. What will happen in the blue suggestive text will end up appearing under the 6th textbox when typing in the 1st one Can this be prevented in any way? Thanks again.. Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 17, 2010 Share Posted August 17, 2010 Is your demo page up to date, I'm not getting any suggestions and it works for me if I add 6 authors then click in the 1st input box and start typing the suggestion box appears underneath the 1st text box, however I don't get any suggestions when typing Peter. Quote Link to comment Share on other sites More sharing options...
billy_111 Posted August 17, 2010 Author Share Posted August 17, 2010 Sorry my table had only one record inside, try with "Jo..".. I have noticed another problem, when you have more than one suggestion, (which you will when you type in "Jo..") I can't select the second and third option, only the first one. Maybe this is something i have done something to mess is up Also can you see the drop down issue when typing into the 1st box and it appears under the 6th? http://www.prima.cse.salford.ac.uk:8080/~ibrarhussain/admin/testing.php Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 17, 2010 Share Posted August 17, 2010 If you have a tool like Firebug, development is a lot easier. You can change things on the fly and look at how code is generated. You still haven't updated your textbox.js file to what I have posted above. There are a few things still wrong with it, such as this: onkeyup=\"suggest(this, inival, 'admin');\" You need to break out of the string to write inival correctly. onkeyup=\"suggest(this, '" + inival + "', 'admin');\" I also surrounded it by single quotes. The same thing applies to the onblur next to it. As for why you can only click the first name, it's something wrong with your PHP I'm assuming. Only the first <li> tag is being placed inside the <ul> tags, the rest are being placed outside the closing </ul> tag. You can see this by using Firebug. Quote Link to comment Share on other sites More sharing options...
billy_111 Posted August 17, 2010 Author Share Posted August 17, 2010 Ok it works beautifully now Let's hope i don't find any problems with it Again i can't thank you enough! Regards Billy Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 17, 2010 Share Posted August 17, 2010 No problems Billy. I can spot a few things you should fix with your CSS. In .AdminSuggestionsBox remove all margins, so margin is set to 0 and adjust the left and top appropriately so that it is positioned correctly. Also remove the top border as this is pushing the bottom list option down to far. I think that was all, so that it positions correctly. Glad to help Billy and hope its smooth sailing. Good luck. Quote Link to comment Share on other sites More sharing options...
billy_111 Posted August 19, 2010 Author Share Posted August 19, 2010 Hi again, One final final problem.. If you take a look at this link: http://www.prima.cse.salford.ac.uk:8080/~ibrarhussain/admin/testing.php And type in the box, if you type something that doesn't exist such as "John Barnes", the blue dropdown doesn't fade out, i have to either choose from the dropdown OR delete all the text.. Can i get around this? Thanks Quote Link to comment Share on other sites More sharing options...
sparklechic007 Posted August 31, 2010 Share Posted August 31, 2010 Hi, I have another query about the autosuggest. I use it with a search, however when the user types in an entry they have to click on one of the matching entries from the autosuggest list and then click on the submit button to perform the search. The search query queries the database for any text in the search field. I tried using 'document.search.submit' but this only searches for the data already in the textfield, for example if the user types 'a' and then clicks on 'apple' from the suggestions list they are shown results from the database that match 'a' rather than 'apple.' I'm not silly, I know I can't use a JS onclick to call a PHP function. I'm thinking this is an AJAX query, any ideas on how I would query the result the user clicks on rather than just what they've typed into the database and direct them automatically to the results rather than the need of the submit button? Quote Link to comment Share on other sites More sharing options...
sparklechic007 Posted August 31, 2010 Share Posted August 31, 2010 ignore my query, I seem to be a fan of posting things and then figuring it out myself. sorry for the post hijack! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.