logo
down
shadow

Datepicker in a while loop


Datepicker in a while loop

By : Jeremiah Kafakoma
Date : November 20 2020, 01:01 AM
I wish this helpful for you i have this issue. I am trying to create a form page where it will show a list of data using a while loop and each of them have the input field option to choose a date which will all be submitted over. So far i have about 4 fields displayed but the datepicker only works for the first one. The rest are just empty text box. , Use class datepicker instead of unique id:
code :
$query = "SELECT * FROM application WHERE Shortlist_status = 1 ORDER BY Candidate_id ASC";
$result = mysqli_query($link, $query) or die(mysqli_error($link));

<html>
<head>

    <link href="stylesheet/style.css" rel="stylesheet"/>
    <script src="script/jquery-1.10.2.min.js"></script>
    <script src="script/jquery-ui-1.10.3.custom.min.js"></script>
    <link rel="stylesheet" href="stylesheet/jquery-ui-1.10.3.custom.min.css">


     <script>
$(function() {
$( ".datepicker" ).datepicker(); // Change this line
});
</script>   


</head>
    <title>
        Arrange interview
    </title>

<body>

while ($row = mysqli_fetch_array($result)) {

(Some other input data)

<input type="text" class="datepicker" name="date"/> // Change this line

}


Share : facebook icon twitter icon
jQuery datepicker, onselect in loop

jQuery datepicker, onselect in loop


By : Johnathan Galt
Date : March 29 2020, 07:55 AM
will be helpful for those in need I don't understand why would you set datepicker on a loop... Use a class instead and it'll be easier. Also why would you have two forms?
code :
<form>
    <input type="text" id="from1" class="from" name="from1" />
    <input type="text" id="to1" class="to" name="to1" />
    <input type="text" id="from2" class="from" name="from2" />
    <input type="text" id="to2" class="to" name="to2" />
</form>
$(".from").datepicker({
    onSelect: function(selectedDate) {
         $(this).next()
                .datepicker("option", "minDate", selectedDate);
    }
})
// not sure you need this...
.next()
.datepicker();
how can i apply if loop in datepicker

how can i apply if loop in datepicker


By : Damien Soitout
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I'm not 100% sure on what you're asking, but I think this might solve your problem (assuming the server knows how to handle blank values):
code :
$(function () {
    $("#SelectA").datepicker({
        onSelect: handleSelectedDates
    });
    $("#SelectB").datepicker({
        onSelect: handleSelectedDates
    });

    function handleSelectedDates(date) {
        var A = $('#SelectA').val();
        var B = $('#SelectB').val();

        Method(A, B, "");                
    }

    var ajaxReq;
    function Method(A,B,C) {
        if (ajaxReq)
            ajaxReq.abort();
        ajaxReq = $.ajax({
            type: "POST",
            url: "Services/MethodName.asmx/Method",
            data: JSON.stringify({ A: A, B: B, C: "" }),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg) {
                place the data into a table
            }
        });
    }
});
Loop on currently displayed DatePicker's days

Loop on currently displayed DatePicker's days


By : Stanley Gilstrap
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Have a look at the Events section of the docs. You can use:
code :
$("#weeklyDatePicker").datetimepicker({
    format: 'MM-DD-YYYY',
    locale: 'fr'
}).on('dp.show dp.update', changeDaysBackground);

function changeDaysBackground() {
  console.log("changeBackground");
  var days = $(".datepicker-days td");
  days.each(function(i) {
    $(this).css("background-color", getRandomColor());
  });
}

function getRandomColor() {
  var letters = '0123456789ABCDEF';
  var color = '#';
  for (var i = 0; i < 6; i++) {
    color += letters[Math.floor(Math.random() * 16)];
  }
  return color;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.css" rel="stylesheet"/>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.19.1/moment-with-locales.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>

<div class="container">
  <div class="row">
    <div class="col-sm-6 form-group">
      <div class="input-group" id="DateDemo">
        <input type='text' id='weeklyDatePicker' placeholder="Select Week" />
      </div>
    </div>
 </div>
closing datepicker when they are in loop ng-bootstrap

closing datepicker when they are in loop ng-bootstrap


By : Yoghurt
Date : March 29 2020, 07:55 AM
will help you I have two datepickers(Start Date and End Date) in a loop. I would like to close startdate datepickers when trying to open enddate and vice versa. I have tried giving different references to input (#start, #close)
code :
<div  class="tmo-floating-label filterItem"  *ngIf="item.id=='startDate'">
        <div class="input-group" >
          <input   type="text" class="form-control" name="startDate" readonly [(ngModel)]="filterItem.dateModel"  ngbDatepicker #startDate="ngbDatepicker" (ngModelChange)="onChange(filterItem)" placeholder="{{filterItem.placeholder}}">
          <button class=" input-group-addon btn btn-primary" (click)="startDateToggle();"><i class="fa fa-calendar" aria-hidden="true"></i></button>
        </div>
      </div>
      <div  class="tmo-floating-label filterItem" *ngIf="item.id=='endDate'">
        <div class="input-group">
          <input   type="text" class="form-control" name="endDate" readonly [(ngModel)]="filterItem.dateModel"  ngbDatepicker #endDate="ngbDatepicker" (ngModelChange)="onChange(filterItem)" placeholder="{{filterItem.placeholder}}">
          <button class=" input-group-addon btn btn-primary" (click)="endDateToggle();"><i class="fa fa-calendar" aria-hidden="true"></i></button>
        </div>
      </div>
    startDateToggle(){
this.startDate.toggle();
this.endDate.close()
}
endDateToggle(){
this.endDate.toggle();
this.startDate.close()
}
angular-ui datepicker initial state of datepicker not formatted per datepicker-popup

angular-ui datepicker initial state of datepicker not formatted per datepicker-popup


By : islam abdelmaaboud
Date : March 29 2020, 07:55 AM
will help you Where/where ever solutions I found they are lengthy, handling by directive etc. So I prefer this short one
Related Posts Related Posts :
  • how to run wordpress php snippet mysql update command from ssh and/ultimately cron
  • how to get xml tag by name
  • ModSecurity maximum post limits (PCRE limit errors)
  • Call controller/action in event listener
  • How to improve performance of contacting WebService?
  • PHP nest variable in echoed string that contains a HTML tag in the end
  • Multiple Ajax request for PHP framework
  • Debug Info from Moodle Plugin
  • passing variables through page
  • Passing PHP $result data to Javascript
  • cakePHP File Download was not found or not readable
  • batch waiting until script finishes
  • PHP variables and anchors in URL
  • php eTag generation using php
  • How to check whether the array is an Integer or Not?
  • Is it possible to install Doctrine without PEAR or Composer? If so, how?
  • Call view script of (parent) Abstract controller Zend
  • Curl PHP cannot display amazon
  • Symfony, getters and setters vs magic methods
  • Using 'continue' PHP instruction outside the loop
  • AJAX POST return data not appearing
  • Can I query relations using an INNER JOIN instead of two queries in Eloquent?
  • Looping through dynamic form fields and inserting into database
  • My php code can't select mysql auto_increment value
  • Store Angularjs form data in database using php
  • I want to run my sh file continuously even if I close my Putty connection
  • file_get_contents equivalent for gzipped files
  • Include PHP file with jQuery
  • php curl headers do not return from website?
  • How to find out, if facebook ID is a user, group or page
  • Connect webhost database to android database
  • preg_match get div content with class
  • Upload multiple files in Laravel 4
  • Count array numbers in multidimensional array
  • PHP Date diff with a difference
  • Search Customer by custom field in Netsuite
  • Is it possible to hide/encode/encrypt php source code and let others have the system?
  • list items to be displayed using php code and array
  • check if row exists mysqli
  • PHP errors loading MySQL
  • setup PostgreSQL with Laravel in MAMP
  • PHP - CodeIgniter Notifications
  • Encrypting a password column in a SQL database
  • New to PHP, trying to extract information from another website
  • JavaScript AmChart to Image for Email
  • Is javascript validation enough to keep my forms secure?
  • Regex extract variables from [shortcode]
  • Download a .mp3 link and save it to computer with PHP
  • Error with the ereg_replace
  • Getting the fields attached to a bundle of an entity in Drupal
  • Php how to check multiple times (within `foreach`) if values from array exists in mysql?
  • MySQL and PHP parsing strange string
  • Pull specific data from multidimensional associative array
  • How to get the original URI extension using PHP Tonic?
  • Upload videos and images from Android to PHP server?
  • Unset a multidimensional array with another multidimensional array with values than key
  • Calling a user e-mail to add to a mailto link PHP
  • Why is override_function coming back as an undefined function
  • PHP mySQLi_fetch_all: iterate through each row
  • Using pow in php
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org