Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Apply date functiοn on text field

  • MikeConom
  • MikeConom's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
10 years 4 months ago - 10 years 4 months ago #102567 by MikeConom
Apply date functiοn on text field was created by MikeConom
Hi

I am trying to apply in text field date function but is not working
Where is the rong:
Code:
$(document).ready(function() {
   var qID = {QID};
   var inputNum = 1;
 
$('#question'+qID+' li:eq('+(inputNum+6)+')').append($(function() { .datepicker({ dateFormat: "dd/mm/yy",changeMonth: true, changeYear: true })}););
 
});
</script>
Last edit: 10 years 4 months ago by MikeConom.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 3 months ago #102597 by tpartner
Replied by tpartner on topic Apply date functiοn on text field
Err...can you give us a better idea of what you are trying to do? What question type are you using and where is the "date" input positioned?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • MikeConom
  • MikeConom's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
10 years 3 months ago #102627 by MikeConom
Replied by MikeConom on topic Apply date functiοn on text field
Thanks for your answer.
i sent you the survey and i have put remarks in the place with my question

Thanks again for your response
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 3 months ago - 10 years 2 months ago #102631 by tpartner
Replied by tpartner on topic Apply date functiοn on text field
Okay, for the benefit of others, it seems that you want to apply a date-picker to the second text input of a multiple-short-text question.

Placing this script in the source of the question will accomplish that:
Code:
<script type="text/javascript" charset="utf-8">  
 
  $(document).ready(function(){
 
    var qID = {QID};
 
    // Apply the datepicker to the second text input
    $('#question'+qID+' input[type="text"]:eq(1)').datepicker({ 
      dateFormat: "dd/mm/yy",
      changeMonth: true, 
      changeYear: true 
    });
  });
</script>


Here is your survey back with the amended code.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 10 years 2 months ago by tpartner.
The following user(s) said Thank You: MikeConom, haroldrio
The topic has been locked.
More
4 years 8 months ago #187149 by haroldrio
Replied by haroldrio on topic Apply date functiοn on text field

tpartner wrote: Okay, for the benefit of others, it seems that you want to apply a date-picker to the second text input of a multiple-short-text question.

Placing this script in the source of the question will accomplish that:

Code:
<script type="text/javascript" charset="utf-8">  
 
  $(document).ready(function(){
 
    var qID = {QID};
 
    // Apply the datepicker to the second text input
    $('#question'+qID+' input[type="text"]:eq(1)').datepicker({ 
      dateFormat: "dd/mm/yy",
      changeMonth: true, 
      changeYear: true 
    });
  });
</script>


Here is your survey back with the amended code.


Thank you for this.

I'm just a snippet hunter and I found out that you can move the rows further down by replacing the 2 or 3 and so on... on line

$('#question'+qID+' input[type="text"]:eq(1)').datepicker({
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose