Clientside validation of a textbox - javascript

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/////
})

Related

Timepicker (trentrichardson) - how to trigger hour dropdown?

I'm using trentrichardson's jQuery timepicker (https://github.com/trentrichardson/jQuery-Timepicker-Addon)
If a user clicks on a relevant time input field, currently the timepicker module will pop up. I'd like the hour dropdown ('select' input) within this module to automatically be activated, i.e. so that the user only has to click once on the time input field to see the hour options, rather than having to click twice: once on the time input field, then once on the hour select input.
I have multiple time input fields on the page if that's relevant
Is this possible? If so, how?
Thanks a lot

dhtmlx calendar selecting time doesn't change input field

I'm using the dhtmlx calendar to select the date and time. But there's a problem when it comes to selecting the time, the user has to select the date again to 'confirm' the change in time. This is not a normal user behaviour. Is there any way to change the input field straight away when the user selects the time?
There's a onTimeChange method and onChange method but I can't seem to put the changed time into the input field.
Please, try to use the following code:
myCalendar.attachEvent("onTimeChange", function(d){
myCalendar.setDate(d);
myCalendar._updateInp();
});

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

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/

javascript and dynamic data

I'm using Dynamic Data 4 on my project.
In a template field there's a button that modify (via javascript) the value of the databound input field.
The button modify the input box value correctly but when the input field get the focus his value it's resetted to the previous value. The same happens when saving the form. If the input box previously received input from the keyboard the value it's correctly stored.
Is that behaviour to be considered normal with those premises? There's a way to avoid it?
Thank you very much.
The problem was caused by the presence of an associated asp:TextBoxWatermarkExtender who resetted the value when the (originally null) textbox got the focus.

Lotus-Notes: Reset Radiogroup via Javascript

I'm currently working on a Lotus Notes solution. We're just using Web forms so client side operations are done via Javascript.
What I want to accomplish is to reset a Group of Radio Buttons. There are 3 possibilities and I want to choose none. (A 'none of them' possibility would be preferable, I know but we are required to reset them)
I currently use:
//Unchecks a single group of Radio Buttons
//groupname - the name attribute of the group which selection needs to be unchecked
function clearRadioButtonGroup(groupName) {
for(i=0;i<document.forms[0].elements[groupName].length;i++) {
document.forms[0].elements[groupName][i].checked = false;
}
}
The problem with this routine is, the Radiogroup gets reset, but on a form submit the old value gets submitted. Any suggestions?
What version of Domino are you using? Since 7.x (I think) a %%Surrogate field gets generated as a hidden field in your HTML that you'll be able to reset, so after deselecting all of the radio button options, you can then clear out the %%Surrogate field and you should then avoid having to select a "None of the above" option.
Matt
The problem is that clearing the radio buttons make no information about them appear in the submitted form data, and Domino seems to interpret that as no change to the field rather than clear the field.
I haven't found any solution to this I really like, but I can think of two options:
Change the radio buttons to include a no choice option.
The alternative is a bit clumpsy:
Add an editable field to the form to use as a flag, hide it from the web browser with css.
Have clearRadioButtonGroup also set the flag field to something.
Have the onChange event of the radio buttons clear the flag field.
In a WebQueryOpen agent, set the radio buttons field to empty if the flag field is non-empty.
Another alternative could be to uses some clever javascript/css trick to hide the no choice option and have clearRadioButtonGroup simply set that choice.
Are you certain that the old value is actually being submitted? Perhaps it just isn't being updated (erased) in the NotesDocument you're editing? Just a hunch...
BTW, you can download a program called Fiddler that will let you inspect the HTTP POSTs, and you can confirm that the POST data doesn't contain any values for that radio button group. That might help narrow down the problem.
Put the following pass thru HTML code on your form:
<input type="hidden" name="FieldName" id="FieldID" value="">
(FieldName and FieldID are the name and id of your radio field on the form)
When you reset your radio through Javascript and submit your document, the field will be reset to blank.

Categories