[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 858
  • Last Modified:

How to modify the Date list form field within Sharepoint Designer 07

I need to modify the default value of the start time and end time of a list form date fields.  As anyone done this?  I also need to modify the minute field drop down to display minute increments instead of 5 minute increments.

Thanks
Abe
0
Ada County
Asked:
Ada County
  • 3
1 Solution
 
raybiesCommented:
There is no ootb way to change the time values of the Date field.
You can use javascript to modify the drop down values.

Add a content editor wp to the bottom of the NewForm.aspx or download/edit/upload the page

 ... loop through the page > find the dropdowns > change the values.
0
 
Ada CountyAuthor Commented:
You wouldn't by chance have an example of this?
0
 
raybiesCommented:
No, but I just did it... and guess what it didn't work. While I can change the drop down values, SharePoint will display unexpected error when you save if the minute field isn't a multiple of 5.

Here you can test:

1.- Follow this (http://www.sharepointology.com/setup/add-web-parts-to-dispform-editform-or-newformaspx/) to add a Content Edit wp.

2.- Paste the code in to the Source Editor window.

3.- CHANGE my date time field name "MYDT" to  your field name.
<script>
function findMyElement(title){
	var elements = document.getElementsByTagName('input');
	for(i=0; i<elements.length;i++){if(elements[i].title.indexOf(title)>-1){return elements[i];}}
	return false;
}
function findMySelect(obj,i){
	var elements = obj.parentElement.parentElement.children[3].children;
	return elements[i];
}

var dt = findMyElement('MYDT');
var dtHr = findMySelect(dt, 1);
var dtMn = findMySelect(dt, 3);

dtMn.options.length=0;
for (i=0; i<60; i++){
	var o = i;
	if(o<10){o= "0"+ i;}
	dtMn.options[i]=new Option(o, o);
}
</script>

Open in new window

Image1.jpg
0
 
raybiesCommented:
So your only option is to create a Custom Field.
0
 
adiga123Commented:
create a feature and when a new entry is made, use object model to insert current DateTime of the  system.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now