Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
57 views
in Q2A Core by
How to put placeholder in ask page and in answer form ?

1 Answer

+1 vote
ago by

You mean for input fields and/or textareas? I don't think there's a simple way of doing this, at least not via PHP. For the title field of the "ask" page you could insert a placeholder attribute in your theme like this:

public function main_part($key, $part) {
  ...
  if ($key == "form") {
    $part['fields']['title']['tags'] .= ' placeholder="foobar"';
  }
  ...
}

However, for the content textarea the required change would depend on what editor you're using AFAICS.

Maybe you could do this with a JavaScript inserted in every page. However, then you'd have to detect the page type in the script, so your modification only applies to the desired pages, and this approach won't work when users have JavaScript disabled.

Also, keep in mind that using placeholders in HTML is not without issues:

...