I am working on a house rental application, i want users to easily notify one another of places they know via whatsapp, i have written the functionality and this is how it should work: Next to the rental amount is a whatsapp sharing link that when the user clicks it carries forward all the rental details to their desired contact but now the problem i am facing is that on my list of rentals the details of the first link are missing, the user can't share all of them but the following link is able to share all its details, i hope i am clear! I have a feeling this is caused by the for loop just dont know how to rectify it, here is my code below:
CODE: {{extend 'layout.html'}} <span style="font-weight: bold; margin-top: 0px; position: absolute;">{{= breadcrumbs() }}</span> <script> function goBack() { window.history.back(); } </script> <div id="goBack" style="position: absolute; right: 25px; color: white; font-weight: bold;" ><a href="javascript:history.back()" style="font-weight: bold;" id="back">BACK</a> </div> <br /> <div class="row"> <div id="headfont4"> Listed Rentals In Kanye & Surrounding Areas <span id="count"> <span class="number" style="color: white;">{{= houseCount}}</span> available houses up for rent </div> </div> <hr /> <div class='row'> <table> <tr> <th>HOUSE OWNER</th> <th>CELL NUMBER</th> <th>HOUSE DESCRIPTION</th> <th>LOCATION</th> <th>RENTAL AMOUNT</th> </tr> {{for details in details:}} <!--THE JQUERY FOR ORCHESTRATING THE WHATSAPP SHARING--> <script> $(document).ready(function() { var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS () || isMobile.Opera() || isMobile.Windows()); } }; $(document).on("click", '.whatsapp', function(e) { //const id = $(this).data('id'); // Extract the data-id attribute of the link. if( isMobile.any() ) { var text = $(this).attr("data-text"); //var url = $('#' + id).attr("data-link"); var message =text; var whatsapp_url = "whatsapp://send?text=" + message + "C/O SESOA&trade"; window.location.href = whatsapp_url; } else { alert("This is only shareable on mobile devices!"); } e.preventDefault(); }); }); </script> <tr> <td> <div id="orgIcon3">{{=A(details.Surname, _href=URL('show', args=[details.id]))}} {{=details.Name}}</div><br /> </td> <td>{{=details.Cell_Number}}</td> <td>{{=details.description}}</td> <td>{{=details.located_at}}</td> <!--THE WHATSAPP LINK FOR SHARING --> *<td>{{=details.amount}}<div id="whatsapp"><a href="#" data-id="{{=details.id}}" class="whatsapp w3_whatsapp_btn w3_whatsapp_btn_large" data-text="Owner: {{=details.Name}} {{=details.Surname}}%0ACell: {{=details.Cell_Number}}%0AHouse Description: {{=details.description}}%0ALocation: {{=details.located_at}}%0ARent: {{=details.amount}}%0A" data-link="www.sesoa.co.bw">Share Details On Whatsapp</a></div></td>* {{pass}} </tr> {{pass}} </table> </div> Regards Mostwanted -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/77b709dc-ce0b-4510-834a-a41b65187cd5%40googlegroups.com.