JavaScript to get SharePoint DateTimeControl SelectedDate value?

Can anyone explain or give an example of how to get the SelectedDate value of a SharePoint datetimecontrol using JavaScript?  I have two of the datetimecontrols on a page and would like to capture the values and use them in query string variables when a button is clicked, but I cannot figure out the correct JavaScript syntax to get it.  The controls are set to DateOnly = True, so I have tried to reference them by the top-level ID (ie. DateTimeControl1) and by the ID of the textbox used for the date portion (ie. DateTimeControl1Date), but so far neither works.  Thanks in advance!
Chanda

In case anyone needs it,  here's a script to work with datetimecontrols including the time
GetSPDateTimeControlValue: function (name) {
var selectedDate = $("input[name$='"+name+"Date']").val();
var selectedHours = $("select[name$='" + name + "DateHours']").val();
var selectedMinutes = $("select[name$='" + name + "DateMinutes']").val();
var dateparts = selectedDate.split("/");
var year = parseInt(dateparts[2]);
var month = parseInt(dateparts[0]);
var day = parseInt(dateparts[1]);
var hours = 0;
if (selectedHours)
if (selectedHours === "12 AM") {
hours = 0;
else {
hours = parseInt(selectedHours);
if (selectedHours.indexOf("PM") > 0) hours += 12;
var minutes=0;
if(selectedMinutes){
minutes = parseInt(selectedMinutes);
var theDateTime = new Date(year, month-1, day, hours, minutes);
return theDateTime;

Similar Messages

  • Set SharePoint PeopleEditor and SharePoint DateTimeControl value to null

    I would like to know how to set SharePoint PeopleEditor and DateTimeControl value to null. Many thanks.

    Hi eg10013,
    To clear PeopleEditor:
    Javascript solution:
    http://www.sharemuch.com/2011/12/04/how-to-address-sharepoint-2010-people-editor-issue-not-clearing/
    C# solution:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/f6cba1cf-823d-48da-953f-51a4c29dff14/remove-values-from-peopleeditor-control?forum=sharepointdevelopmentlegacy
    To clear DateTimeControl:
    Javascript solution:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/7f21e2d0-2b41-4a8a-9950-85f821a7602a/set-the-datetime-field-using-javascript?forum=sharepointcustomizationprevious
    C# solution:
    http://stackoverflow.com/questions/3045663/sharepoint-datetimecontrol-set-it-to-null
    Thanks,
    Qiao Wei
    TechNet Community Support

  • How to get Document Set property values in a SharePoint library in to a CSV file using Powershell

    Hi,
    How to get Document Set property values in a SharePoint library into a CSV file using Powershell?
    Any help would be greatly appreciated.
    Thank you.
    AA.

    Hi,
    According to your description, my understanding is that you want to you want to get document set property value in a SharePoint library and then export into a CSV file using PowerShell.
    I suggest you can get the document sets properties like the PowerShell Command below:
    [system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint")
    $siteurl="http://sp2013sps/sites/test"
    $listname="Documents"
    $mysite=new-object microsoft.sharepoint.spsite($siteurl)
    $myweb=$mysite.openweb()
    $list=$myweb.lists[$listname]
    foreach($item in $list.items)
    if($item.contenttype.name -eq "Document Set")
    if($item.folder.itemcount -eq 0)
    write-host $item.title
    Then you can use Export-Csv PowerShell Command to export to a CSV file.
    More information:
    Powershell for document sets
    How to export data to CSV in PowerShell?
    Using the Export-Csv Cmdlet
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to get sharepoint online (office 365) data in cloud/windows azure (provider) hosted app using Javascript?

    How to get sharepoint online (office 365) data in cloud/windows azure (provider) hosted app using Javascript?
    I wish to retrieve sharepoint online data in html page (hosted in windows azure) using javascript and then need to play with AngularJS

    Hi,
    According to your description, you might want to get data from Office 365 SharePoint Online(also known as host web) and pass to the Provider Hosted App which is hosted
    in Windows Azure site.
    I would suggest you take a look at the links below about accessing data from the host web
     for a quick start:
    https://msdn.microsoft.com/en-us/library/office/fp179927(v=office.15).aspx#SP15Accessdatafromremoteapp_Codeexample
    http://dannyjessee.com/blog/index.php/2014/07/accessing-sharepoint-data-from-provider-hosted-apps-use-the-right-context/
    Aother sample solution for your reference:
    https://code.msdn.microsoft.com/SharePoint-2013-Get-the-0ec36bb6
    Best regards
    Patrick Liang
    TechNet Community Support

  • How to get SharePoint Groups using Javascript in SP2013 ?

    How to get SharePoint Groups using Javascript in SP2013 , not JSOM please

    Here is the code that worked for me:
    <script type="text/javascript">
    var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups";
      var requestHeaders = { "accept" : "application/json;odata=verbose" };
      $.ajax({
        url : requestUri,
        contentType : "application/json;odata=verbose",
        headers : requestHeaders,
        success : onSuccess,
        error : onError
      function onSuccess(data, request){
    var s='';
     for (var i = 0; i < data.d.results.length; i++)
    s +=data.d.results[i].LoginName+'\n';
        alert(s);
     function onError(error) {
        alert("error");
    </script>

  • Get a web property value with REST

    Hello,
    i want to get the value of a property that i have set in my web property bag using REST call,
    is it possible?
    Thanks a lot

    Hi,
    According to your post, my understanding is that you want to get the web property.
    Per my knowledge, we could not use the listdata.svc to get the web properties, however, we can use the
    Webs web service to achieve it.
    https://social.msdn.microsoft.com/Forums/en-US/198dd547-22fd-4fda-89f2-b76553498c3b/get-web-properties-through-web-service
    What’s more, we can also use the JavaScript Client Object Model to access the property bag.
    http://derekgusoff.wordpress.com/2012/04/24/accessing-the-web-property-bag-with-javascript/
    http://www.jeremythake.com/2013/10/using-the-sharepoint-csom-api-to-get-a-property-bag-value/
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How to get selected Row/Cell value in i5Grid

    Hi Friends,
    Can anyone help to how to find the selected Row/Cell value of a i5Grid object. I am able to register the event handlers which are getting invoked on row/cell selection. But I want to know how can I get the value of selected Cell/Row. I would like to add selected Items from one i5Grid to another one.
    So want to know how can I get and set the value of i5Grid object.
    MII version 14.0 SP4 Patch
    Thank in advance
    Shaji Chandran

    Hi Shaji,
    Here is my code.
    <!DOCTYPE HTML>
    <HTML>
    <HEAD>
        <TITLE>Your Title Here</TITLE>
        <META http-equiv="X-UA-Compatible" content="IE=edge">
        <META http-equiv='cache-control' content='no-cache'>
        <META http-equiv='expires' content='0'>
        <META http-equiv='pragma' content='no-cache'>
        <SCRIPT type="text/javascript" src="/XMII/JavaScript/bootstrap.js" data-libs="i5Chart,i5Grid,i5SPCChart"></SCRIPT>
        <SCRIPT>
            var Grid = new com.sap.xmii.grid.init.i5Grid("STC/C5167365/i5Grid_TagQuery", "STC/C5167365/TagQuery");
            Grid.setGridWidth("640px");
            Grid.setGridHeight("400px");
            Grid.draw("div1");
        function setCellValue()
        Grid.getGridObject().setCellValue(1,1,"Set");
        function setCellValueAgain()
        Grid.getGridObject().setCellValue(1,1,"Changed Again");
        </SCRIPT>
    </HEAD>
    <BODY>
        <DIV id="div1"></DIV>
        <INPUT type="Button" value="setCellValue" onClick="setCellValue()"/>
        <INPUT type="Button" value="setCellValueAgain" onClick="setCellValueAgain()"/>
    </BODY>
    </HTML>
    Regards,
    Sriram

  • Jquery/JavaScript to get current browser's name and its version

    Hi,
    I using sharepoint 2010, 
    Is it possible using Jquery/JavaScript to get current browser's name and its version.
    when my sharepoint site home page opens i need to display a popup msg of current browser name and its version.
    can anyone help me on this.
    With Regards,
    RK

    Please use the below code snippet:
    And here is the source code that performed the browser detection:
    var nVer = navigator.appVersion;
    var nAgt = navigator.userAgent;
    var browserName = navigator.appName;
    var fullVersion = ''+parseFloat(navigator.appVersion);
    var majorVersion = parseInt(navigator.appVersion,10);
    var nameOffset,verOffset,ix;
    // In Opera 15+, the true version is after "OPR/"
    if ((verOffset=nAgt.indexOf("OPR/"))!=-1) {
    browserName = "Opera";
    fullVersion = nAgt.substring(verOffset+4);
    // In older Opera, the true version is after "Opera" or after "Version"
    else if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
    browserName = "Opera";
    fullVersion = nAgt.substring(verOffset+6);
    if ((verOffset=nAgt.indexOf("Version"))!=-1)
    fullVersion = nAgt.substring(verOffset+8);
    // In MSIE, the true version is after "MSIE" in userAgent
    else if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
    browserName = "Microsoft Internet Explorer";
    fullVersion = nAgt.substring(verOffset+5);
    // In Chrome, the true version is after "Chrome"
    else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) {
    browserName = "Chrome";
    fullVersion = nAgt.substring(verOffset+7);
    // In Safari, the true version is after "Safari" or after "Version"
    else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
    browserName = "Safari";
    fullVersion = nAgt.substring(verOffset+7);
    if ((verOffset=nAgt.indexOf("Version"))!=-1)
    fullVersion = nAgt.substring(verOffset+8);
    // In Firefox, the true version is after "Firefox"
    else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
    browserName = "Firefox";
    fullVersion = nAgt.substring(verOffset+8);
    // In most other browsers, "name/version" is at the end of userAgent
    else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) <
    (verOffset=nAgt.lastIndexOf('/')) )
    browserName = nAgt.substring(nameOffset,verOffset);
    fullVersion = nAgt.substring(verOffset+1);
    if (browserName.toLowerCase()==browserName.toUpperCase()) {
    browserName = navigator.appName;
    // trim the fullVersion string at semicolon/space if present
    if ((ix=fullVersion.indexOf(";"))!=-1)
    fullVersion=fullVersion.substring(0,ix);
    if ((ix=fullVersion.indexOf(" "))!=-1)
    fullVersion=fullVersion.substring(0,ix);
    majorVersion = parseInt(''+fullVersion,10);
    if (isNaN(majorVersion)) {
    fullVersion = ''+parseFloat(navigator.appVersion);
    majorVersion = parseInt(navigator.appVersion,10);
    document.write(''
    +'Browser name = '+browserName+'<br>'
    +'Full version = '+fullVersion+'<br>'
    +'Major version = '+majorVersion+'<br>'
    +'navigator.appName = '+navigator.appName+'<br>'
    +'navigator.userAgent = '+navigator.userAgent+'<br>'
    VARIABLES
    DESCRIPTION
    navigator.appCodeName 
    The code name of the browser 
    (e.g. Mozilla) 
    navigator.appName
    The name of the browser 
    (e.g. Netscape or Microsoft Internet Explorer) 
    navigator.appVersion
    The browser version (e.g. 3.0 or 4.0) 
    navigator.userAgent
    The header information for the browser. 
    (e.g. Mozilla/4.0) 
    navigator.platform
    The users operating system
    (e.g. WIN32)
    http://www.w3schools.com/js/js_window_navigator.asp
    Click on Propose as Answer if the solutions works for you.

  • Cant select date from Sharepoint DateTimeControl inside TabPanel of AjaxToolKit

    I am using AjaxToolKit in my webpart , when i put SharepointDateTimeControl in TabContainer , i cant select date time
    this my code
    <cc1:TabContainer ID="TabContainerActionDetail" runat="server" ActiveTabIndex="0"
    OnActiveTabChanged="loadInformation" AutoPostBack="true" CssClass="ajax__tab_blueGrad-theme">
    <cc1:TabPanel ID="TabPanelAction" runat="server" HeaderText="...">
    <ContentTemplate>
    <table width="100%">
    <tr>
    <td class="tdhead">
    <SharePoint:DateTimeControl ID="datedebValue" runat="server" Enabled="False" AutoPostBack="False"
    Calendar="Gregorian" CalendarImageUrl="/_layouts/images/calendar.gif" CssClassTextBox="ms-input"
    DateOnly="False" DatePickerFrameUrl="/_layouts/iframe.aspx" DatePickerJavaScriptUrl="/_layouts/datepicker.js"
    FirstDayOfWeek="-1" FirstWeekOfYear="0" HijriAdjustment="0" HonorSecondsAndMilliseconds="False"
    IsRequiredField="False" IsValid="True" LocaleId="1036" MaxDate="12/31/9999 23:59:59"
    MinDate="" SelectedDate="12/26/2013 19:17:38" ShowWeekNumber="False" TabIndex="-1"
    TimeOnly="False" TimeZoneID="-1" UseTimeZoneAdjustment="False" />
    </td>

    I am using AjaxToolKit in my webpart , when i put SharepointDateTimeControl in TabContainer , i cant select date time
    this my code
    <cc1:TabContainer ID="TabContainerActionDetail" runat="server" ActiveTabIndex="0"
    OnActiveTabChanged="loadInformation" AutoPostBack="true" CssClass="ajax__tab_blueGrad-theme">
    <cc1:TabPanel ID="TabPanelAction" runat="server" HeaderText="...">
    <ContentTemplate>
    <table width="100%">
    <tr>
    <td class="tdhead">
    <SharePoint:DateTimeControl ID="datedebValue" runat="server" Enabled="False" AutoPostBack="False"
    Calendar="Gregorian" CalendarImageUrl="/_layouts/images/calendar.gif" CssClassTextBox="ms-input"
    DateOnly="False" DatePickerFrameUrl="/_layouts/iframe.aspx" DatePickerJavaScriptUrl="/_layouts/datepicker.js"
    FirstDayOfWeek="-1" FirstWeekOfYear="0" HijriAdjustment="0" HonorSecondsAndMilliseconds="False"
    IsRequiredField="False" IsValid="True" LocaleId="1036" MaxDate="12/31/9999 23:59:59"
    MinDate="" SelectedDate="12/26/2013 19:17:38" ShowWeekNumber="False" TabIndex="-1"
    TimeOnly="False" TimeZoneID="-1" UseTimeZoneAdjustment="False" />
    </td>

  • Get default row fillColor value

    Hello,
    Sorry for my english it's not my native language.
    The problem i have is that i am using a table that grow each time a row is filled in.
    When some value's are chosen in a dropdownlist the backgroundcolor has to change in red.
    This part is working good already.
    The problem is that the table has alternating row shading.
    So when the specified values are chosen the color changes to red.
    But when the form filler chose another value the color stays red.
    Now i want to get the default fillColor value as a variable and use it for the else color.
    So the variable = the default background color of the alternathing row.
    This i the code i got already:
    form1.InventarisKoelinstallaties.Subform4.Table1.Row1.Cell8::change - (JavaScript, client)
    var RowDefaultColor = Row1.fillColor();
    if (xfa.event.newText == "R22"){
    Row1.fillColor = "255,0,0";
    else if (xfa.event.newText == "R12"){
    Row1.fillColor = "255,0,0";
    else if (xfa.event.newText == "R409a"){
    Row1.fillColor = "255,0,0";
    else if (xfa.event.newText == "R408a"){
    Row1.fillColor = "255,0,0";
    else{
    Row1.fillColor = "RowDefaultColor";
    I hope someone can help me.

    What you want to do is access the template object (as it exists in Designer) of your subform. Here's a function I found awhile back that John Brinkman wrote:
    function findTemplateField(vField)
    var vSOM = vField.somExpression.replace(/\[[0-9]*\]\./g, ".");
    vSOM = vSOM.replace(/xfa\.form/, "$template");
    return xfa.resolveNode(vSOM);
    Put that any where in your change event or even reference it through a script object, your choice.
    Edit the final else line in your code to:
    Row1.fillColor=findTemplateField(Row1).fillColor;
    Kyle

  • Not able to get the taxonomy field value of meta data field type

    Hi Everyone,
    Not able to get the taxonomy filed value from the metadata filed type.
    Any one can help me on this.
    Label, TermGuid, ValidatedString are showing empty when i debug the code.
    Below is the code which i used to get the taxonomy filed value

    Hi,
    Can you please try getting this way?
    var taxonomyField = listItem.Fields.GetFieldByInternalName(fieldName) as TaxonomyField;
    if (taxonomyField.AllowMultipleValues)
    var fieldValuesCollection = listItem[taxonomyField.Title] as TaxonomyFieldValueCollection;
    return fieldValuesCollection.Select(x => new Guid(x.TermGuid)).ToList();
    else
    var fieldValue = listItem[taxonomyField.Title] as TaxonomyFieldValue;
    return new List<Guid>() { new Guid(fieldValue.TermGuid) };
    Hope it helps!
    Thanks,
    Avni Bhatt
    If this helped you resolve your issue, please mark it Answered

  • [OBIEE-11g] Error getting Nqid always null value

    Hi to all, I've a problem to load Nqid in a dashboard on 11g OBIEE.
    The javascript function return always a null value and the document.cookie instruction return an empty string ...
    somebody could help me ?!
    p.s.: in the firefox properties there is a cookie that contain the id but i can't read it
    function getNqid() {
    var nameEQ = 'nQuireID=';
    var ca = document.cookie.split(';');
    for(var i=0; i<ca.length; i++) {
    var c = ca;
    while (c.charAt(0)==' ')
    c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0)
    return c.substring(nameEQ.length,c.length);
    return null;

    Hi,
    You might want to check the NQQuery.log to see the code that it is running before making a connection. Just to confirm that the connection pool step is working fine, could you try with a simple select statement and see that it does not error out. If it does not, you may want to revisit the procedure code again. I understand from the error that it is expecting something after the END statement (kind of weird though!!). I assume in this case, it could not parse that this is a stored procedure call itself may be. One thread I found is http://stackoverflow.com/questions/4270818/ora-06550-and-pls-00103 which you may want to look for the line break characters.
    Hope this helps.
    Thank you,
    Dhar

  • Not getting all the attributes value from Trusted Recon in eventhandler

    Hi,
    I am not getting the values of all the attributes in hashmap from Trusted recon in eventhandler.
    Following is the hashmap value I am getting :
    Parameter Hashmap value is {re_key=1869, Email=[email protected], Role=Full-Time, act_key=22, User Login=TUser43, Xellerate Type=End-User, Last Name=User43, First Name=Test}
    Please let me know how to get all the attributes value in eventhandler. I need to take some decisions based on these attributes.
    Thanks

    You should be getting all the values in the recon event.
    To get the current user states for all the records in the bulk event use this:
    Identity[] currentUserStates = (Identity[]) eventDataHashMap.get("CURRENT_USER");
    Now when you are looping through your bulkParametersp[], you can use the same get from the currentUserStates:
    Identity currentUser = null;
    currentUser = currentUserStates[counter];
    Now if the attribute is not in your hashmap, you can use:
    currentUserState.getAttributes().get(attribute)
    -Kevini

  • Not able to get the profile option value

    Hi,
    Not able to get the profile option value after i changed the new value in the application.
    I am using fnd_global.apps_initialize to initialize the apps from PLSQL code to get the updated profile option value. But fnd_profile.value is not getting fetched the updated value. Still it is fetching the old one. I mean it is stored in database cache. Please any one let me know how to get the new value every time after i changed the value.
    Thanks

    What is the application release?
    Is this a custom or seeded profile option?
    Can you confirm that the value got changed from the application (query the profile option and verify the value)?
    Can you reproduce the issue if you use an API to update this profile option as per (How to Change Profile Option Value Without Forms? [ID 943710.1])?
    Thanks,
    Hussein

  • How to get the list of values for a dynamic parameter using Web Services SDK?

    <p>I am struggling to get the list of values for a dynamic parameter of a report.</p><p>I am using Java Web Services SDK ... I tried to use PromptInfo.getLOV().getValues() method but it does not work.</p><p>First of all ... is this possible (to get the list of values for a dynamic param) using Web Services?</p><p>Second of all, if this is possible, how should I do it ... it seems it works fine when running the report from CMC. It asks for DB logon info and after that it provides a list of values.</p><p>Thx </p>

    <p>Your assumption is correct. We are trying to get the LOVs from the Crystal Report. I was not aware that this is not supported by Web Services SDK.</p><p>We used Web Services SDK to integrated the Crystal Reports in our web application. We implemented some basic actions for reports: schedule, view instances, run ad-hoc reports.</p><p>We encountered this problem when trying to run/schedule reports with dynamic parameters (a list of values from DB). We were unable to get the LOVs.</p><p>Please let me know if you can think of an alternative to look at.</p><p>Thanks a lot,</p><p>Catalin </p>

Maybe you are looking for