how to insert a javascript calendar in a form (PHP) - javascript

im new in php but i need to do something
i have a form with 2 texboxs and 1 button
the first field will be filled with the name of the user and the 2nd field need to be filled with a date.
That information is going to be store in a mysql database
I want: when a person get to the 2nd textbox, it should popup the javascript calendar that i have in a folder, and when u select one date in the calendar.. it must fill the textbox2 with that date.
i dont know how.
i heard u can do it with >insert onclick="".. but i tried to put the name of the calendar there and it didn't worked

Give a try to jquery-ui's datepicker, that is exactly what you want.
http://jqueryui.com/datepicker/

Related

How to have a single textfield for exp-month and exp-year

I'm using stripe for CC processing and used the stripe example form and JS code. The form has two separate fields for expiration month and year. each has data-stripe="exp-month" and data-stripe="exp-year"
I'd like to use one textfield for month and year and have the user enter the input like: 10/2020
Question
Since stripe reads the data based on data-stripe attribute. Is there a way I can parse the input 10/2020 from one textfield and programmatically set the data-stripe attributes?
I'm not sure how everything is glued together and being sent, but you could have hidden input fields with the data-stripe="exp-month/year" attributes and then split the visible input value on / and set the hidden values.
Here is a rather basic jsbin where you can see month and year in the console output.

Autopopulate form input texboxes with javascript

I have this following problem because I don't have expertise in Javascript
I'm testing a Facebook login at
http://goo.gl/3R3owa
After the user is logged in Facebook an alert windows with the birthday and location comes up. So far so good.
Rather than show that window i will like to autopopulate the day, month and year input boxes in that page.
Is there any way to do that?
Here is my code
http://goo.gl/IFhJdu
Thanks in advance!
Assuming that you have all the data in the response object and element_id# is a valid id of an element present on the HTML page. You can simply use following JS code do set the value of an input field in JS:
document.getElementById('element_id1').value = response.gender;
document.getElementById('element_id2').value = response.birthday;
document.getElementById('element_id3').value = response.location.name;
Similarly, for feeding the data to an HTML element, you can use innerHTML, for example:
document.getElementById('element_id1').innerHTML= response.gender;
(You can use the above code to replace the alert() method in you JS code.)

how to get name of dynamically generated text input in php

I want to make a page like this
http://agprotective.com.au/invoice/invoice.htm
There someone can add multiple date,site,start time, end time, hours amount by click the button + or can remove the row using - sign button. How can I get the value of that input in php? Normarlly we use $_POST['here-is-the-value-of-name-attribute-of-the-input-tag'];
But in the case http://agprotective.com.au/invoice/invoice.htm , I do not know what will be the value of the name attribute of the tag.
Can anyone tell me how to get the values of the dynamically generated (button generated) input tags and then send them to database.
The correct way to do this is simple:
<input name="myinput[]" />
PHP will then have:
$_POST['myinput'][0], $_POST['myinput'][1]...
The page you linked does it in a stupid manner, if I'm honest.

Clientside validation of a textbox

I have an asp.net control textbox, clicking on which a jquery timepicker appears and user can select any time.But I want to validate the selected time so that it is one hour greater than the current time in the client side. I mean when textbox value will be changed it should be validated. Can anyone help me how to do this?
The input that the client's selection goes into will have an id. Do
$('#that_id').change(function() {
Validation Code/////
})

how do i use the jquery validation plugin to conditional validate

I am using the bassistance jQuery plugin validation.
I have a drop down list with 2 values.
If the first value is selected by the user a valid date field needs to be populated and if the second option is selected then a textbox needs to be filled with some text.
If nothing is selected then it need to return a validation on this as well
How can I achieve this?
thanks
Well, if it is a dropdown, you can't really have "nothing" selected. So, it sounds like in your case, you might want to make three options, the first of which is something like "Choose one", you can then you the jQuery to test for this condition and throw an alert if that value isn't one of the two that trigger an action. You can then force them to go back and choose of the two other options.

Categories