Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

How can I change the HTML input code of the search field?

edited August 2012 in Vanilla 2.0 - 2.8

I'd like to add a default value and some other customisations to the search field HTML but I can only see the PHP that generates the search box the the default.master file rather than the actual code itself, where can I find this?

Answers

  • Options
    KasperKasper Scholar of the Bits Copenhagen Vanilla Staff
    edited August 2012

    First of all: It's a really bad idea altering the core view files (with the exception of default.master.tpl). You shouldn't edit the markup directly if you want to add a pre-defined value to the search field. You'd be better off using jQuery and the attr() function like this:

    jQuery('your-selector-here').attr('value', 'Some default value...');
    

    If I were you, I'd use the placeholder value instead though:

    jQuery('your-selector-here').attr('placeholder', 'Your placeholder text...');
    

    A placeholder is removed automatically once the field is populated.

    //Kasper

    Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub

  • Options

    Hi kasperisager, I don't mind editing the markup directly, I'll keep a backup. I need to make some other changes too, where is the search core view file?

    Thanks (:

  • Options

    I'm aiming to end up with something like this http://d.pr/i/13H1, so far I've been able to colour it, and remove the border. Just looking to add that text in there and setup the search button like that. Placeholder isn't a great solution as this isn't supported by Internet Explorer.

  • Options

    grep -ri Search * and look at the results in the view folders.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Hi, sorry what does grep -ri mean?

  • Options
    peregrineperegrine MVP
    edited August 2012

    you can google grep - it searches for terms in your code. helps you locate what you are looking for to do what you want to do, assuming you have some basic ability to read and change code.

    more info here -

    http://vanillaforums.org/discussion/comment/164114/#Comment_164114

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Command-line? I think it's best that I stay away from that... haha

Sign In or Register to comment.