1. #1
    Sencha User catacaustic's Avatar
    Join Date
    Jul 2007
    Location
    "A Land Down Under"
    Posts
    618
    Vote Rating
    1
    catacaustic is on a distinguished road

      0  

    Question [SOLVED] dateField formatting problem

    [SOLVED] dateField formatting problem


    I've got some dateField areas on one of my forms to allow so that I can read in dates. The problem that I'm facing is that I need to interact with a back-end system that reads dates as the "Unix" style of "YYYY-MM-DD" and my customer needs to see the dates in the format "d/m/YYYY" when they are entered into the dateField area.

    I know that I can set the format to be the correct one as far as the display goes, but how do I get the format correct when I'm submitting the dates to the remote script that needs them in a different format? I've looked and can't see anything that can help me on this one.

  2. #2
    Sencha User catacaustic's Avatar
    Join Date
    Jul 2007
    Location
    "A Land Down Under"
    Posts
    618
    Vote Rating
    1
    catacaustic is on a distinguished road

      0  

    Default


    Is there no way to do this? I thought there'd have to be something out there that'd work?

  3. #3
    Sencha User wolverine4277's Avatar
    Join Date
    Mar 2007
    Location
    Necochea, Buenos Aires, Argentina
    Posts
    61
    Vote Rating
    0
    wolverine4277 is on a distinguished road

      0  

    Default


    Maybe...

    Code:
    form.submit(
    	{
    		failure: function() {...},
    		params:	{
    			...
    			dateWithFormat: form.findField('datefield').getValue().format('Y/m/d'),
    			...
    		},
    		success: function() {...}
    		url: '...'
    	}
    );
    where 'datafield' is the id or name of the Ext.form.DateField in the form and dateWithFormat is the parameter received by the script in the server side...

  4. #4
    Sencha User catacaustic's Avatar
    Join Date
    Jul 2007
    Location
    "A Land Down Under"
    Posts
    618
    Vote Rating
    1
    catacaustic is on a distinguished road

      0  

    Default


    Wolverine... You're a complete legend! Works perfectly. Thanks for helping out.

Thread Participants: 1