dependent
dependent
i have a couple of date fields, eventdatefrom and eventdateto
what i would like to do is set the value of eventdateto to the same as eventdatefrom, when eventdatefrom is being updated.
This, together with some validation, will help prevent the user setting an end date before the start date.
I have been trying to use
editor.dependent( 'tblevent.EventType', function ( val ) {
alert(val);
}
but the event doesn't seen to be triggered from a text input, only from a select
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
dependent()
will be triggered by the change event by default (which simply typing into a text input does not trigger - although it should when the focus then leaves that input).You can have it listen for other events using the
event
option in the options parameter that you can pass to it (so for example you could listen forkeyup
). Seedependent()
for details.Allan
the fields are date fields which use the datepicker, so i wasn't seeing anything happen at first as i wasn't using the keyboard. !
i can get the result i want now, but not when i want.
the mouse events below will work, but if i try to use the change event, nothing happens
What date picker specifically -
datetime
, or a plug-in? Can you link to the page?Allan
I am using the datetime field from editor 1.5.2.
i will post a link tomorrow
I've just been looking into this and figured out what was happening. I've got a fix which will be in 1.5.3 (which should be out tomorrow, all being well!). If you want to apply it immediately, in the Editor file search for the function
_writeOutput
- you will find the following block of code:Replace with:
That will trigger the dependent method with a regular change event.
Thanks for letting me know about this issue.
Allan
I am having a couple of problems with the editor (1.5.3) datetimefield
..will start a new thread as original question has been answered.