Hi
I was sure I had seen this somewhere before but can't find it.
I have a set date picker fields pre-filled with dates (for classes). I need a control for each date so that I can clear a specific date. How would I do that?
Regards
Nick
I was sure I had seen this somewhere before but can't find it.
I have a set date picker fields pre-filled with dates (for classes). I need a control for each date so that I can clear a specific date. How would I do that?
Regards
Nick
Hi Nick,
I'm not sure that I understand the question :-( Could you add buttons and use JavaScript snippets to clear the input value when they are clicked?
Bob
I'm not sure that I understand the question :-( Could you add buttons and use JavaScript snippets to clear the input value when they are clicked?
Bob
Hi Bob,
Made a bit of a pig's ear about this one. Yes - a button and JavaScript. I was worrying that I had seen some feature of datepicker that dealt with setting a null date but have now found the code that I was looking for. You helped me with that quite a while ago.
sorry to have wasted your time .:|
Nick
Made a bit of a pig's ear about this one. Yes - a button and JavaScript. I was worrying that I had seen some feature of datepicker that dealt with setting a null date but have now found the code that I was looking for. You helped me with that quite a while ago.
sorry to have wasted your time .:|
Nick
Hi Bob
I found what I was looking for - some jQuery that you gave me a while ago. But this works
The only trouble is that this causes the form to be submitted when i clear a field. How can I stop that submit?
Regards
Nick
I found what I was looking for - some jQuery that you gave me a while ago. But this works
<input id='njjoidimgweek2'
title='Click: clear date.'
type='image' class="njjoclsErase" src="components/com_u3aV5/common/img/erase.png"
onclick=clearFields('njjoidweek2');
/>
function clearFields(inputToClear) {
fieldToClear = document.getElementById(inputToClear);
$(fieldToClear).value = '';
return true;
}
The only trouble is that this causes the form to be submitted when i clear a field. How can I stop that submit?
Regards
Nick
Hi Nick,
Hmmm from a quick Google, please try replacing return true; with return false; I think that should stop the submit behaviour.
Bob
Hmmm from a quick Google, please try replacing return true; with return false; I think that should stop the submit behaviour.
Bob
Eureka! Your solution plus a missing piece.
apart from a typo (a missing " that had no effect) I had to add that return to the onclick event
onclick="return clearFields('njjoidweek2')"
Nick
<input id='njjoidimgweek2'
title='Click: clear date.'
type='image' class="njjoclsErase" src="components/com_u3aV5/common/img/erase.png"
onclick="return clearFields('njjoidweek2')"
/>
apart from a typo (a missing " that had no effect) I had to add that return to the onclick event
onclick="return clearFields('njjoidweek2')"
Nick
This topic is locked and no more replies can be posted.