Hi,
I'd like to use a placeholder for the login form. Can anyone point me in the right direction?
What do you mean by placeholder?
Like this:
<td class="input">
<input id="rcmloginuser" type="text" autocapitalize="off" size="40" name="_user" placeholder="Your email">
</td>
Probably the simplest way is to make a plugin to include a javascript file and add it that way.
oh, I have no experience with js or php, so that would be a bit difficult for me.. Anyone here that would try to make such a plugin?
This is just a shot in the dark, completely untested.
Plugin file:
<?php
class placeholder extends rcube_plugin {
public function init() {
$this->include_script("placeholder.js");
}
}
JS file:
$('input[name="_user"]').attr('placeholder', '<username>');
$('input[name="_pass"]').attr('placeholder', '<password>');
Replace the <username> and <password> in the JS file with the placeholders you want.
Thanks SKaero.
Just tested the code, but it didn't work
Did it load the js file?
No, I do not think so..
Did you make the placeholder.php and placeholder.js files in a folder named placeholder in the plugins directory and activate the plugin in the main.inc.php?
Yes, or I use plugin manager from myroundcube so I activate it from the config in plugin_manager. I can try to activate it from the main.inc.php instead.
I just added placeholder to main.inc.php, and it loads the js, but its still not working.
Any error messages in the browser js console?
No, none..
Try changing the JS file to the following:
$(function() {
$('input[name="_user"]').attr('placeholder', '<username>');
$('input[name="_pass"]').attr('placeholder', '<password>');
});
Thanks SKaero, works perfect! :D