Showing posts with label Modifiy sharepoint field lenths. Show all posts
Showing posts with label Modifiy sharepoint field lenths. Show all posts

Friday, November 4, 2011

Modify the lengths of list form fields through the javascript in Sharepoint

modify the NewForm/EditForm fileds width through the javascript as below:

<---script type="text/javascript" language="javascript">
//width
var inputs = document.getElementsByTagName("input"); //this for textboxes
var textareas = document.getElementsByTagName("textarea"); //this for multiline textboxes

var selects = document.getElementsByTagName("select"); //this for dropdown and date fileds
var width = 225;// need to set the wi

for(var i=0;i{
if(inputs[i].className == "ms-long" && (inputs[i].title=="custcity" || inputs[i].title=="cust_st" || inputs[i].title=="custzip") )
{
inputs[i].style.width = "75px";
}
else
{
inputs[i].style.width = width + "px";
}

}

for(var i=0;i{
if(textareas[i].className == "ms-long" && textareas[i].title=="stat_history")
{
textareas[i].style.width = width +200 + "px";
}
else
{
textareas[i].style.width = width + "px";
}

}

for(var i=0;i{
if(selects[i].className == "ms-RadioText")

{
selects[i].style.width = width + "px";

}

}
<--/script>