- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2012 07:35 AM
good morning All,
I need some help on how to make an alert message when the user tried to click on a read-only textbox.
In the Client Script, I don't see onClick option. (note: this is follow up to this forum link correspondences: Textbox and Icon of glide date time Fields)
Thank you again!
Dor
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2012 08:17 AM
Hi Dor
Try the following:
function onLoad() {
$('change_request.start_date').observe('click', respondToClick);
$('change_request.end_date').observe('click', respondToClick);
$('change_request.work_start').observe('click', respondToClick);
$('change_request.work_end').observe('click', respondToClick);
function respondToClick(event) {
alert('Please use corresponding calendar icon when choosing dates.');
}
}
Cheers
Dale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2012 08:12 AM
The script should be something like this,
var startDate = $('change_request.start_date');
startDate.onclick = "clickMe()";
function clickMe(){
alert('oops, you just clicked a read-only field');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2012 08:43 AM
Hi Abhiram,
Thanks for the tip...I tried it but it seems that I'm still missing something. Here's my code right now:
Type: onLoad
table: change_request
Active: true
GLobal: true
Inherited: true
//===========================================================================
function onLoad() {
try {
var startDate = $('change_request.start_date'); //Planned start date
startDate.readOnly = true;
startDate.style.color='black';
startDate.style.backgroundColor='#F0F0F0';
startDate.onclick = "dontClickReadOnly()";
var endDate = $('change_request.end_date'); //Planned end date
endDate.readOnly = true;
endDate.style.color='black';
endDate.style.backgroundColor='#F0F0F0';
endDate.onclick = "dontClickReadOnly()";
var workStart = $('change_request.work_start'); //work start date
workStart.readOnly = true;
workStart.style.color='black';
workStart.style.backgroundColor='#F0F0F0';
workStart.onclick = "dontClickReadOnly()";
var workEnd = $('change_request.work_end'); //work end date
workEnd.readOnly = true;
workEnd.style.color='black';
workEnd.style.backgroundColor='#F0F0F0';
workEnd.onclick = "dontClickReadOnly()";
function dontClickReadOnly(){
alert('Please use corresponding calendar icon when choosing dates.');
}
} catch(e) {
}
}
//=================================================================
I tried placing the dontClickReadOnly function outside the scope of onLoad function and outside the try-catch block but no difference (when I tried clicking the textbox of any of the dates, it would not show the alert message.)
Appreciate your response again (as well as other's response)...
Dor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2012 09:39 AM
My bad, I am so sorry Dor.I tried it in my instance as well and it doesn't seem to be working. But i remember using it and thats the reason i had replied to your post. I guess thats because, all these fields have default handlers defined, and so we are not able to override it. I will wait for some expert to reply!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-04-2012 09:09 AM
No worries...I'm looking at javascript APIs (http://api.prototypejs.org/) and other forums and hopefully I may find a tip somewhere...