Thanks to look into it , i'll upadte my patch for error message, Jacques in our form-widget the ids are auto generated and is something like "formName_fieldName" , so how could you query through ids.
Currently the code is handling two field FromDate and ThruDate , but it may be possible if anyone want to use it for WorkEffort StartDate and EndDate than? so i talked about generalised solution .
As we do in ftls we add a class for field and in js we can fetch fields that have our class and do the operations accordingly , that something i was saying and if possible we'll apply here , So anyone can use for checking two date fields which have different names.
Its weekend so i'll try it on Monday. Happy Weekend....
Thanks & Regards