Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chris 92 posts 238 karma points
    Aug 11, 2015 @ 08:29
    Chris
    0

    Search for property values

    Hey,

    I have another problem with MVC and could use some help.

    I used SmartBlog ( https://our.umbraco.org/projects/starter-kits/smart-blog/ ) and build myself a simple Blog and now want to add my own partialviews for it and edit some other things.

    See my blog here: http://lundp.de/de/blog (at the moment only in german, because itÄs still work in process).

    What I want: User should type in a search word, lets say "umbraco". When "umbraco" is typed in I want that all articles are displayed if tag, title, author include the word "umbraco".

    My problem at the moment is: How do I get the value out of the search input? And how should my razor code look like to display the articles properly?

    Thanks, Chris

  • Lars-Erik Aabech 350 posts 1102 karma points MVP 8x c-trib
    Aug 11, 2015 @ 13:59
    Lars-Erik Aabech
    0

    Hi Chris,

    You might find some useful info and code samples to get started here: http://24days.in/umbraco/2013/getting-started-with-examine/

    Lars-Erik

  • Chris 92 posts 238 karma points
    Aug 12, 2015 @ 07:26
    Chris
    0

    Thanks Lars,

    tried that but couldn't get it to work (see comment under the article).

    Is there no simple way to get the value out of a input field with MVC?

    I'd like to do something like this:

    (javascript/jquery) var searchterm = Searchfield.value
    @{
      foreach(var term in searchterm) {
       <p>post something for each searchterm</p>
     }
    

    Is this not possible somehow? I understand that javascript is client side and MVC server side, so they won't work together, but MVC should be able to to something like this alone or not?

  • Lars-Erik Aabech 350 posts 1102 karma points MVP 8x c-trib
    Aug 12, 2015 @ 07:37
    Lars-Erik Aabech
    0

    You have to use AJAX to fire the search from JavaScript.
    Here's something that looks like a nice tutorial. :)

    http://mytechworld.azurewebsites.net/2013/11/easy-umbraco-search-with-razor-surfacecontrollers-and-ajax/

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies