Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateInput change function not working #1100

Open
dchadcluff opened this issue Jul 22, 2015 · 3 comments
Open

DateInput change function not working #1100

dchadcluff opened this issue Jul 22, 2015 · 3 comments

Comments

@dchadcluff
Copy link

$(":date").dateinput({
format: 'mm/dd/yyyy',
// a different format is sent to the server
change: function() {
var isoDate = this.getValue('yyyy-mm-dd');
$("#backendValue").val(isoDate);
}
});

No longer changes the value that is sent on the backend. The value that is sent to the server on submission is the format specified in format.

@alibby251
Copy link
Contributor

Hi dchadcluff,

I've run some tests - as far as I can see, it seems to work as detailed in the docs? Take a look at http://jquerytools.github.io/documentation/dateinput/index.html - the docs state
"Specifies how the date value is formatted in the input field. See formatting for more details."

In the tests I ran, I had format: 'You selected: dddd / dd.mm.yyyy', in my code; it returned "2015-07-29" in the browser's console log.

Are you able to post an example that shows it doesn't change the value for you please, so we can see what it is doing for you?

@dchadcluff
Copy link
Author

I should specify that I am running this in conjunction with jquery 1.10.2 and not including jquerytools version 1.7 of jquery.

<script>
    $(":date").dateinput({
        format: 'mm/dd/yyyy',
        // a different format is sent to the server
        change: function() {
            var isoDate = this.getValue('yyyy-mm-dd');
            $("#backendValue").val(isoDate);
        }
    });
</script>

returns 'mm/dd/yyyy' to the server.

@alibby251
Copy link
Contributor

I've tried the same demo again, but jQuery 1.10.2 / jQuery Migrate 1.2.1 (to allow for the known $.browser issue), and the 1.2.6 CDN link of Tools (excluding jQuery) - I still can't replicate the issue; it's working as per the documentation for me?

You say it is returning 'mm/dd/yyyy' to the server - I assume you've checked this using a console log statement, right? Is anything else manipulating the value once it has been rendered? I've also tried piping out the value from (in this case) #backendValue. and it matches that shown in the console log, so I'm struggling to see where the issue is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants