Finally the problem is solved, and it has not to be with web2py. I am using jqm (Jquery Modal Plugin)
The sample code has <div class="jqmWindow" id="photomodal"> <a href='#' class="jqmClose">{{=T("Close")}}</a> <br /> <img class="photo jqmClose" src="" /> </div> where the src attr for img is filled dynamically by the plugin modal. Firefox was raising validation error because of that. I used the w3c validator to solve this problem! Thank you all