0

I have been working with Parse for a few weeks and i am stuck with using a date input in HTML and saving it to parse.com.

Below is a sample of my code. my input has a name of jobDate. my column in parse is jD as a string. i can use the column as a date also but i just want the month,day,year to be saved. (no time).

Thank you in advance.

Job Date: <input type="date" onfocus="fncClearText(this)" onblur="fncClearText(this)" name="jobDate" id=e >

var jd = document.getElementsByName("jobDate").value;

RollCall.save({ jD:jd }, {
     success: function (object) {
           $(".sent").show();
     },
     error: function (model, error) {
            $(".notSent").show();
     }
});
joyBlanks
  • 6,419
  • 1
  • 22
  • 47
Morgan Hayes
  • 321
  • 2
  • 25
  • What browser are you using? In Chrome I get [only the date without the time](http://jsfiddle.net/v2tw9Lck/). – Dave Aug 21 '15 at 21:39
  • 2
    What behavior are you expecting, and what is the actual behavior? Depending on the browser, `value` may already return a String. However, do note that `getElementsByName` returns a list, not a single element. Consider using `getElementById` instead. – Palpatim Aug 21 '15 at 21:40
  • Thank you for your reply, I am looking to use a variable in the save line to get results. the behavior now is parse.com data is blank for the field with the variable. is there different syntax to use with a variable? (chrome browser) using 'code' geElementsById 'code' is the same. i can place the date variable in the HTML by using 'code' .innerHTML 'code' and i see the date on the page. does not work in the Parse.com save command. – Morgan Hayes Aug 24 '15 at 15:43

1 Answers1

0

You actually don't need parse! Use the date with a .value Heres an example..

<input type="date" class="dateInput">

<script>
const date = document.querySelector(".dateInput");
console.log(date.value);
</script>
Vivian
  • 1
  • 1