Sunday, 30 June 2024

Fill date in input type date using javascript

<input type="date" name="DOB"  id="dob" placeholder="Date of Birth  " >

Input type date takes date in format of yyyy-mm-dd. But it will show you as per your local clock setting.

While editing A form we need to fill the date coming from the database into the date picker. You will have to change format yyyy-mm-dd otherwise date will not be show .

My date formate coming from the database is 15-05-1985
 <input type="hidden" id="ddob" value="@Model.DOB" />

var dt = new Date($("#ddob").val().split("/").reverse().join("/"));

        var td = dt.getFullYear() + "-";

        month = (dt.getMonth() + 1);

        if (month < 10)

            td += "0" + month;

        else

            td += month;

        td += "-";

        day = dt.getDate();

        if (day < 10)

            td += "0" + day;

        else

            td += day;       

        $("#dob").val(td);


Next Topic

Thursday, 27 June 2024

Install Let's Encrypt SSL into Godaddy shared Linux hosting

 



Let's Encrypt provide free SSL certificate. Mostly Hosting service provider automatically install Let's Encrypt SSL but some hosting provider like Godaddy doesn't support Let's Encrypt by default.

Thursday, 18 April 2024

Form Control Post C# ASP.Net MVC

 Form Post is a simple process to submit data to the server. C# works the same as other languages like PHP works. Problems arise with the radio button and checkbox. These controls are different from the textbox. So we need different ways to detect user selection. This is post will help you to learn checkbox and radio button selection using form POST.

Radio Button selection detect 

HTML

<form method="post" >
  <
input type="radio"  name="SalaryPerson" value="1" checked/> Salary Person
  <input type="radio" name="SalaryPerson" value="0" /> Self Empployee
 
<input type="submit" value="Save" >
</
form>

Wednesday, 17 April 2024

Query String URI in Route in Code codeigniter 4

 


You can pass some information using the query string. Query string is very useful for creating dynamic page. As you can see in the image given above, the Query string is a circle of red color. Page content will be changed as per the product ID provided.