jQWidgets Forums

jQuery UI Widgets Forums Editors DateTimeInput post datetimeinput value as a form variable

This topic contains 9 replies, has 5 voices, and was last updated by  Mahesh 5 years, 7 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author

  • jcf378
    Participant

    this may be simple, but i’m having trouble figuring out how to get the Date value entered in the DateTimeInput and treat it like a standard form text-input variable so that when I submit a form containing the DateTimeInput, its value can be read as a $POST in the PHP target file. I imagine it involves using:
    var selectedDate = $(“#dateinput'”).jqxDateTimeInput(‘getDate’);
    and then somehow assigning the value of the ‘selectedDate’ variable to perhaps a hidden variable in my HTML form.
    Thoughts on the javascript to do this?
    –Jason


    Peter Stoev
    Keymaster

    Hi Jason,

    Set the “name” attribute of the DateTimeInput’s DIV tag and the value would be posted.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Amir Zojaji
    Participant

    Hi,
    I searched a lot for this point in documentation, but don’t find.
    Really I needed it for jqxCombox and jqxNumberInput. Finally I inserted a hidden field in form and set code for “change” event so the new value be inserted in the form field.
    But today I read Peter’s help.

    Is this point is mentioned in documentation? But why didn’t I find it?
    Regards


    Amir Zojaji
    Participant

    and other question:
    How can I insert an initial value for jqxNumberInput?
    In HTML INPUT tag we have value=””, so we write:
    <INPUT TYPE=”TEXT” NAME=”xxx” VALUE=”12″/>

    What is the equivalent way in jqxNumberInput?
    Regards.


    Peter Stoev
    Keymaster

    Hi Amir Zojaji,

    It works the same way it works for all standard HTML Inputs. If you want the widget’s value to be posted in a form post, then add its “name” attribute. Examples with Forms can be found on the Demos page – see php, asp .net or jsp samples.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Amir Zojaji
    Participant

    Hi Peter,
    I inserted the name attribute for the DIV tag, but I want to set an initial value to datetimeinput.
    like HTML standard as follows:
    <input type=”” name=”date” value=”2016-02-05 20:30″ />
    how can I set initial value for the jqxDateTimeInput?


    Peter Stoev
    Keymaster

    Hi Amir Zojaji,

    After you create jqxDateTimeInput, use either its val method or setDate method to set its value.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    post datetimeinput value as a form variable #87599

    nbourdeau
    Participant

    What if I am initializing the widget from an input field instead of a div ? Is it supported ?
    I have setted the name and value but it does not process it correctly and the value never gets submitted…
    The original input field remains in the dom but never get updated with the date selection!

    post datetimeinput value as a form variable #87608

    Peter Stoev
    Keymaster

    Hi nbourdeau,

    You have to set the “name” attribute of the input inside the datetimeinput. If you create it from INPUT tag, after the initialization, select the datetimeinput’s input tag with jQuery selector and set its “name” attribute by using jQuery’s attr function. This will get the job one.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    Mahesh
    Participant

    Hi Peter,

    I want to get the date value from jqxDateTimeInput and I am not getting it in the Form keys collection after the form submit (post).

    My code lines are as below:

    <form id=”myForm” name=”myForm” style=”font-size:smaller” method=”post” action=”SaveCandidate” enctype=”multipart/form-data”>
    <input id=”BirthDate” name=”BirthDate” type=”date” />
    <input id=”JoiningDate” name=”JoiningDate” type=”datetime” />
    <input id=”btnSave” type=”submit” value=”Save” style=”width: 80px; “>
    </form>

    <script type=”text/javascript”>
    $(“#BirthDate”).jqxDateTimeInput({ width: ‘300px’, height: ’25px’ });
    $(“#JoiningDate”).jqxDateTimeInput({ width: ‘300px’, height: ’25px’ });
    </script>

    In fact the keys named “BirthDate” and “JoiningDate” are there in the form key collection but the value is missing.
    (for e.g. myHttpContext.Request.Form(“JoiningDate”) value is “”)

    It will be more helpful if you provide a fully working sample as I have already gone through your old posts in this regards.

    Regards,
    Mahesh

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.