Hello,
I have 2 tabs and each has few form elements in it (text box, radio etc.) I am validating some of the elements before form submit and showing error tooltip next to input element. This works perfect for active tab however for inactive tab, it does not return any position value.
below is the code
tab id is parameter "divbodyid"
- $('#'+divbodyid+' .required').each(function(){
- //inputlength = $(this).val().length;
- inputlength = $(this).val();
- if (inputlength == null) {
- inputlength = 0;
- }else {
- inputlength = $(this).val().length;
- }
-
- if (inputlength == 0 && $(this).css('visibility') != "hidden" ) {
- console.log($(this).attr('id')+" is Empty");
- tposition = $(this).position().top;
- lposition = $(this).position().left;
- flposition = 210 + lposition;
- if (flposition >= 950) {
- flposition = 950;
- tposition = tposition + 30;
- errorboxtype = "errorbox-top";
- }else {
- errorboxtype = "errorbox-left";
- }
-
- thisid = $(this).attr('id');
- thiselement = "errorbox-"+thisid;
- if ( $("#"+thiselement).length == 0)
- {
- $("<div class='"+errorboxtype+"' id='errorbox-"+$(this).attr('id')+"' style='left:"+ flposition +"px; top:"+tposition+"px'>This field can not be blank</div>").appendTo( $('#'+divbodyid) );
- }
- }