Re: How can I increase the text field length?
I thought about this possibility too, but as the input-Tag is not created in the template field, you have to use css or javascript to define the maxlength of the input field.
In the template you only have textfield, so you can't define maxlength in the source code.
But you can probably edit the source-code and fill in some javascript, just look what id your input field has (you can temporarily insert the text#id from the left "elements box") name and id are the same for the input field.
fill in some JavaScript like that at the end (replace name and new-size):
<script type="text/javascript">It didn't work when I tested it. Anyone another idea?document.forms[0].element[name].size=new-size;
document.forms[0].element[name].style.width=new-size;
</script>
David
from /mod/data/lib.php line 170, inside function display_add_field().
After that I could use css like :
#field_1 {
width: 50px;
}
to specify field widths.
Cheers,
Petri
Hi,
i use moodle 3.1+ and try to decrease the size of an INPUT textfield.
I had a look in /mod/data/style.css and tried some modifications there, but none of them working.
The hint from Petri Asikainen is good but the display_add_field() function has no style="width: 300px" code. so i think the position of this point has changed in version 3.1+.
any suggestions?
Don't change the code, just add CSS or JS into the 'Add template' as below:
Make sure you have clicked on the 'Disable editor' button.
You can find the 'Field ids' in the Available tags' area.
This does not work for me! I will change the size of the INPUT textfield! There is no CSS working or maybe i did not find the right css title.
my css class is .datagrid so i use
.datagrid input {width:50px;}
.datagrid input{height: 500px;} is working but is not needed ;) something for the width is blocking the css code.
to change the size but this is not working.
Here you are.
Tips and Tricks:
1. Apply CSS to Table is not enough to change the size of a textfield.
2. Every field needs a <style>
3. The JS method is working as well, you can get the same result.
great! this is realy helpful! thanks a lot!