| | |
Overide Textinput settings
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
I want to override the maxlength (chars) seetings below for my board, however I dont have direct access to the templet . Is there a way to script it to increase maxlength?
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<tr> <td colspan="2" class='pformstrip'>Topic Settings</td> </tr> <tr> <td class='pformleft'>Topic Title</td> <td class='pformright'><input type='text' size='40' maxlength='50' name='TopicTitle' value='' tabindex='1' class='forminput' /></td> </tr> <tr> <td class='pformleft'>Topic Description</td> <td class='pformright'><input type='text' size='40' maxlength='40' name='TopicDesc' value='' tabindex='2' class='forminput' /></td> </tr>
Always carry a flagon of whiskey in case of snakebite and furthermore always carry a small snake.
W. C. Fields
W. C. Fields
what kind of board are you using? can you use javascript in it?
if you can insert javascript on the page, do this...
if you can insert javascript on the page, do this...
html Syntax (Toggle Plain Text)
<script type="text/javascript"> function changeMaxLength() { var maxlen = '50';//change this to what maxlength you want var node=document,classname='forminput'; var a = []; var i; var re = new RegExp('(^| )'+classname+'( |$)'); var els = node.getElementsByTagName("*"); for(var i=0,j=els.length; i<j; i++) if(re.test(els[i].className))a.push(els[i]); for(i=0;a[i]!=undefined;i++){ a[i].setAttribute("maxlength",maxlen); } } changeMaxLength(); </script>
toast
that works great but effects the textarea aka the post typing area, not the title field, can you
change getelementsbytagname to get elements by classname?
<td class='pformright'><input type='text' size='40' maxlength='50' name='TopicTitle' value='' tabindex='1' class='forminput'
change getelementsbytagname to get elements by classname?
<td class='pformright'><input type='text' size='40' maxlength='50' name='TopicTitle' value='' tabindex='1' class='forminput'
Always carry a flagon of whiskey in case of snakebite and furthermore always carry a small snake.
W. C. Fields
W. C. Fields
replace the origional with this
html Syntax (Toggle Plain Text)
<script type="text/javascript"> function changeMaxLength() { var names=new Array(),name; names[0] = 'TopicTitle'; // make a new array entry for each input name names[1] = 'TopicDesc'; for(ib=0;names[ib]!==undefined;ib++){ var maxlen = '50';//change this to what max len you want var node=document,name=names[ib]; var a = []; var i; var re = new RegExp('(^| )'+name+'( |$)'); var els = node.getElementsByTagName("*"); for(var i=0,j=els.length; i<j; i++) if(re.test(els[i].getAttribute("name")))a.push(els[i]); for(i=0;a[i]!=undefined;i++){ a[i].setAttribute("maxlength",maxlen); } } } changeMaxLength(); </script>
Last edited by hunkychop; Mar 19th, 2008 at 2:58 pm.
toast
Once again, Thanks for you kind efforts Hunky,
Unfortunately That didnt work either. I suspect the problem could be that the coding for maxlength could be written in @ server side aswell?
In anycase Your efforts have taught me some about about javascript and will prove useful in the future, I have saved them away to reference when needed.
I appreciate your taking the time to try to help me like this. Thankyou very much mate, all the best,
cheers Inny
Unfortunately That didnt work either. I suspect the problem could be that the coding for maxlength could be written in @ server side aswell?
In anycase Your efforts have taught me some about about javascript and will prove useful in the future, I have saved them away to reference when needed.
I appreciate your taking the time to try to help me like this. Thankyou very much mate, all the best,
cheers Inny
Always carry a flagon of whiskey in case of snakebite and furthermore always carry a small snake.
W. C. Fields
W. C. Fields
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Menu problem in firefox
- Next Thread: Suduko box
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxcode ajaxhelp animate api automatically beta boarder box bug calendar captchaformproblem card checkbox child class column cookies createrange() css cursor dependent disablefirebug dom download dropdown editor element engine error events explorer ext file firehose flash form forms google gwt html htmlform ie8 iframe image() images internet java javascript jawascriptruntimeerror jquery jsf jsfile jump math matrixcaptcha microsoft mimic mp3 mysql object offline onmouseoutdivproblem onreadystatechange parent passing pdf php player post problem progressbar rated rating regex runtime scroll search select session shopping size sql star stars stretch text textarea twitter validation w3c web website window windowofwords windowsxp wysiwyg xml xspf \n





