finding an xpath with many //tr without giving the exact //tr[value] - xpath
so my issue is I am trying to verify for example "11305487/10" is displaying without giving the tr cell value in the event for some reason it happens to change at some point. I want it to skim the tr looking for the text() I provide but cant seem to get it down. any help is appreciated!
firepath gives me an xpath of
html/body/table[2]/tbody/tr/td/form/table/tbody/tr/td/table/tbody/tr[2]/td/div/table/tbody/tr[3]/td/div[1]/table/tbody/tr[4]/td[4]
the below xpath fails
"//table[contains(div[1]/tr/td[4]/text(),'11618632')]"
<div id="scrollableDocumentsTable" onscroll="onScrollHideFilters();">
<table id="documentsTable" width="960" cellspacing="1" cellpadding="0" border="0" align="center" style="table-layout: fixed;">
<tbody>
<tr bgcolor="#008677">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<td align="center">
<td class="BlackSmall" align="left" style="padding-left: 15px; padding-right: 5px;">09/25/14</td>
<td class="BlackSmall" align="left" style="padding-left: 15px; padding-right: 5px;">10/25/14</td>
<td class="BlackSmall" align="left" style="padding-left: 15px; padding-right: 5px;">11618632</td>
<td class="BlackSmall" align="right" style="padding-left: 15px; padding-right: 5px;">71.54</td>
<input id="bp_2" type="hidden" value="N" name="bp_2"/>
<td class="BlackSmall" align="left" style="padding-left: 15px; padding-right: 5px;">Mail</td>
<td class="BlackSmall" align="right" style="padding-left: 15px; padding-right: 5px;">0.00</td>
<td class="BlackSmall" align="left" style="padding-left: 15px; padding-right: 5px;">xxxxxxxxxxx</td>
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr height="19" bgcolor="#FFFF99">
<tr height="19" bgcolor="#CCCCCC">
<tr>
</tbody>
</table>
</div>
You could use // to recursively search all sub-nodes:
"//table//td[contains(text(), '11618632')]"
//table matches all table nodes in the document. //table//td matches all td nodes which are descendants of a table node.
td[contains(text(), '11618632')] will match only those td nodes whose text contains the string '11618632'.
Related
Validate excel sheet lines against application lines using loop with Ruby
Friends, I'll try to be as detailed as possible. Thomas Walpole It helped me to validate if the information of each row of the worksheet corresponds to each row of the grid of my application. However I would like to use the for to validate this to make it more beautiful. How would I change the solution below? As I don't know how to use the loop under these conditions, I'll have to do it by hand item by item in my worksheet and validate one by one with the items on the front My spreadsheet is configured like this: | Element | Status | | Nº Hidrômetro |Invisível | | Leitura |Invisível | | Diâmetro do HD |Invisível | | Filtro |Invisível | | Padrão de instalação do HD |Invisível | | Equipamento de telemetria acoplado |Invisível | Spreadsheet.client_encoding = 'UTF-8' book = Spreadsheet.open('c:/temp/gab.xls', "r") sheet = book.worksheet 0 #get the first row referring to the second column take_hidrometro_planilha = sheet.rows[1][1] pp "O item da planilha N. hidrometro esta configurado para #{take_hidrometro_planilha}" expect(page).to have_css("tr.tvRow:nth-child(2) .tvCell:nth-child(6) img[tooltip='#{take_hidrometro_planilha}']") #takes the tooltip on the front according to the desired line and saves it in a variable take_hidrometro_front = find("tr.tvRow:nth-child(2) .tvCell:nth-child(6) img[tooltip]")[:tooltip] pp "O item do Front N. hidrometro esta configurado para #{take_hidrometro_front}" #validates the worksheet variable with the variable captured on the front pp expect(take_hidrometro_front).to eql(take_hidrometro_planilha) #################### HTML CODE ################################### <div style="" class="tvContent"> <div style="display:table;width:100%; background:inherit;"> <div style="display:table-cell;"> <table width="100%" class="tvGrid"> <tbody> <tr> <th colspan="1" class="tvHeader">Nome</th> <th colspan="1" class="tvHeader">Etiqueta</th> <th colspan="1" class="tvHeader">Tipo Dado</th> <th colspan="1" class="tvHeader">Valores </th> <th colspan="1" width="1" class="tvHeader">Preenchimento automático</th> <th colspan="1" class="tvHeader">Status </th> <th colspan="1"></th> </tr> <tr oncontextmenu="if(!this.cancelEvent) {sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','BtnDropDownRow#',0,'','','');return false;} delete this.cancelEvent;" onclick="if(notSelecting()) sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','Select#',0,'','','');" onmousedown="if(event.ctrlKey) this.cancelEvent=true;" class="tvRow tvRowOdd tvRoll" style="cursor:pointer;"> <td valign="center" align="left" class="tvCell">FLAG_INSERIMENTO_LETTURA_E</td> <td valign="center" align="left" class="tvCell"> Leitura Existente</td> <td align="left" class="tvCell" valign="center" nowrap=""></td> <td valign="center" align="left" class="tvCell"></td> <td align="left" width="1" class="tvCell" valign="center" tooltip=""></td> <td valign="center" align="center" class="tvCell"><img tooltip="Invisível" src="r/std/static/minus16.gif"></td> <td align="center" width="30" style="line-height:1px;padding:0px;" class="tvCell" valign="center"> <div onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1d13','BtnDropDownRow#',0,'','','','');" class="but"> <div><img src="r/std/icons/menu64.png" class="icon" draggable="false" align="absmiddle"></div> </div> </td> </tr> <tr oncontextmenu="if(!this.cancelEvent) {sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','BtnDropDownRow#',1,'','','');return false;} delete this.cancelEvent;" onclick="if(notSelecting()) sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','Select#',1,'','','');" onmousedown="if(event.ctrlKey) this.cancelEvent=true;" class="tvRow tvRowEven tvRoll" style="cursor:pointer;"> <td valign="center" align="left" class="tvCell">XWFMSLETMATRICOLA_E</td> <td valign="center" align="left" class="tvCell"> Nº Hidrômetro</td> <td align="left" class="tvCell" valign="center" nowrap=""></td> <td valign="center" align="left" class="tvCell"></td> <td align="left" width="1" class="tvCell" valign="center" tooltip="[AIMPMATRICOLA]"> <button onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1d13','AUTOFILLBTN#',1,'','','','');" class="but butAct" tabindex="0" tooltip="Preenchimento automático ativado" type="BUTTON"> <div><img src="r/std/icons/checkboxselected64.png" class="icon" draggable="false" align="absmiddle"></div> </button> </td> <td valign="center" align="center" class="tvCell"><img tooltip="Invisível" src="r/std/static/minus16.gif"></td> <td align="center" width="30" style="line-height:1px;padding:0px;" class="tvCell" valign="center"> <div onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1d13','BtnDropDownRow#',1,'','','','');" class="but"> <div><img src="r/std/icons/menu64.png" class="icon" draggable="false" align="absmiddle"></div> </div> </td> </tr> <tr oncontextmenu="if(!this.cancelEvent) {sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','BtnDropDownRow#',2,'','','');return false;} delete this.cancelEvent;" onclick="if(notSelecting()) sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','Select#',2,'','','');" onmousedown="if(event.ctrlKey) this.cancelEvent=true;" class="tvRow tvRowOdd tvRoll" style="cursor:pointer;"> <td valign="center" align="left" class="tvCell">XWFMSLETLETTURA_E</td> <td valign="center" align="left" class="tvCell"> Leitura</td> <td align="left" class="tvCell" valign="center" nowrap=""></td> <td valign="center" align="left" class="tvCell"></td> <td align="left" width="1" class="tvCell" valign="center" tooltip=""></td> <td valign="center" align="center" class="tvCell"><img tooltip="Invisível" src="r/std/static/minus16.gif"></td> <td align="center" width="30" style="line-height:1px;padding:0px;" class="tvCell" valign="center"> <div onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1d13','BtnDropDownRow#',2,'','','','');" class="but"> <div><img src="r/std/icons/menu64.png" class="icon" draggable="false" align="absmiddle"></div> </div> </td> </tr> <tr oncontextmenu="if(!this.cancelEvent) {sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','BtnDropDownRow#',3,'','','');return false;} delete this.cancelEvent;" onclick="if(notSelecting()) sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','Select#',3,'','','');" onmousedown="if(event.ctrlKey) this.cancelEvent=true;" class="tvRow tvRowEven tvRoll" style="cursor:pointer;"> <td valign="center" align="left" class="tvCell">XWFMSLETID_XWFMTDCO_E</td> <td valign="center" align="left" class="tvCell"> Diâmetro do HD</td> <td align="left" class="tvCell" valign="center" nowrap=""></td> <td valign="center" align="left" class="tvCell"></td> <td align="left" width="1" class="tvCell" valign="center" tooltip="[XGABAIMPID_XWFMTDCO]"> <button onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1d13','AUTOFILLBTN#',3,'','','','');" class="but butAct" tabindex="0" tooltip="Preenchimento automático ativado" type="BUTTON"> <div><img src="r/std/icons/checkboxselected64.png" class="icon" draggable="false" align="absmiddle"></div> </button> </td> <td valign="center" align="center" class="tvCell"><img tooltip="Invisível" src="r/std/static/minus16.gif"></td> <td align="center" width="30" style="line-height:1px;padding:0px;" class="tvCell" valign="center"> <div onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1d13','BtnDropDownRow#',3,'','','','');" class="but"> <div><img src="r/std/icons/menu64.png" class="icon" draggable="false" align="absmiddle"></div> </div> </td> </tr> <tr oncontextmenu="if(!this.cancelEvent) {sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','BtnDropDownRow#',4,'','','');return false;} delete this.cancelEvent;" onclick="if(notSelecting()) sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','Select#',4,'','','');" onmousedown="if(event.ctrlKey) this.cancelEvent=true;" class="tvRow tvRowOdd tvRoll" style="cursor:pointer;"> <td valign="center" align="left" class="tvCell">XWFMSLETSIGILLO_E</td> <td valign="center" align="left" class="tvCell"> Filtro</td> <td align="left" class="tvCell" valign="center" nowrap=""></td> <td valign="center" align="left" class="tvCell"></td> <td align="left" width="1" class="tvCell" valign="center" tooltip="[XWFMAIMPSIGILLO]"> <button onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1d13','AUTOFILLBTN#',4,'','','','');" class="but butAct" tabindex="0" tooltip="Preenchimento automático ativado" type="BUTTON"> <div><img src="r/std/icons/checkboxselected64.png" class="icon" draggable="false" align="absmiddle"></div> </button> </td> <td valign="center" align="center" class="tvCell"><img tooltip="Invisível" src="r/std/static/minus16.gif"></td> <td align="center" width="30" style="line-height:1px;padding:0px;" class="tvCell" valign="center"> <div onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1d13','BtnDropDownRow#',4,'','','','');" class="but"> <div><img src="r/std/icons/menu64.png" class="icon" draggable="false" align="absmiddle"></div> </div> </td> </tr> <tr oncontextmenu="if(!this.cancelEvent) {sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','BtnDropDownRow#',5,'','','');return false;} delete this.cancelEvent;" onclick="if(notSelecting()) sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','Select#',5,'','','');" onmousedown="if(event.ctrlKey) this.cancelEvent=true;" class="tvRow tvRowEven tvRoll" style="cursor:pointer;"> <td valign="center" align="left" class="tvCell">XWFMSLETID_XWFMTUBI_E</td> <td valign="center" align="left" class="tvCell"> Padrão de instalação do HD</td> <td align="left" class="tvCell" valign="center" nowrap=""></td> <td valign="center" align="left" class="tvCell"></td> <td align="left" width="1" class="tvCell" valign="center" tooltip="[XWFMAIMPID_XWFMTUBI]"> <button onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1d13','AUTOFILLBTN#',5,'','','','');" class="but butAct" tabindex="0" tooltip="Preenchimento automático ativado" type="BUTTON"> <div><img src="r/std/icons/checkboxselected64.png" class="icon" draggable="false" align="absmiddle"></div> </button> </td> <td valign="center" align="center" class="tvCell"><img tooltip="Invisível" src="r/std/static/minus16.gif"></td> <td align="center" width="30" style="line-height:1px;padding:0px;" class="tvCell" valign="center"> <div onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1d13','BtnDropDownRow#',5,'','','','');" class="but"> <div><img src="r/std/icons/menu64.png" class="icon" draggable="false" align="absmiddle"></div> </div> </td> </tr> <tr oncontextmenu="if(!this.cancelEvent) {sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','BtnDropDownRow#',6,'','','');return false;} delete this.cancelEvent;" onclick="if(notSelecting()) sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1d13','Select#',6,'','','');" onmousedown="if(event.ctrlKey) this.cancelEvent=true;" class="tvRow tvRowOdd tvRoll" style="cursor:pointer;"> <td valign="center" align="left" class="tvCell">XGABSLETTELCOUPEQUIP_E</td> <td valign="center" align="left" class="tvCell"> Equipamento de telemetria acoplado</td> <td align="left" class="tvCell" valign="center" nowrap=""></td> <td valign="center" align="left" class="tvCell"></td> <td align="left" width="1" class="tvCell" valign="center" tooltip="[XGABAIMPTELCOUPEQUIP]"> <button onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1d13','AUTOFILLBTN#',6,'','','','');" class="but butAct" tabindex="0" tooltip="Preenchimento automático ativado" type="BUTTON"> <div><img src="r/std/icons/checkboxselected64.png" class="icon" draggable="false" align="absmiddle"></div> </button> </td> <td valign="center" align="center" class="tvCell"><img tooltip="Invisível" src="r/std/static/minus16.gif"></td> <td align="center" width="30" style="line-height:1px;padding:0px;" class="tvCell" valign="center"> <div onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1d13','BtnDropDownRow#',6,'','','','');" class="but"> <div><img src="r/std/icons/menu64.png" class="icon" draggable="false" align="absmiddle"></div>
Assuming you're using the 'spreadsheet' gem - the guide provides all the info you need to see how to use a loop here - https://github.com/zdavatz/spreadsheet/blob/master/GUIDE.md sheet.each 1 do |row| expected_tooltip = row[1] expect(page).to have_css("tr.tvRow:nth-child .tvCell:nth-child(6) img[tooltip='#{expected_tooltip}']") end That is all you need to do to verify all the tooltip texts in your spreadsheet exist on the page. If you need to verify they are in a specific order (why?) then you'd probably need something like xls_offset = 1 row_offset = 2 sheet.each_with_index(xls_offset) do |row, idx| expected_tooltip = row[1] expect(page).to have_css("tr.tvRow:nth-child(#{row_offset+idx}) .tvCell:nth-child(6) img[tooltip='#{expected_tooltip}']") end
p:ajax update of more than one element
I'm having trouble when trying to update two elements. This is my code: <h:form id="all"> <table id="gt" class="CartContents Stylize General" cellspacing="0" cellpadding="0" style="display:#{clothesBean_i.convertToList(clothesBean_i.cartclothes)}"> <tbody> <!-- AFFICHAGE PRODUIT --> <ui:repeat value="#{clothesBean_i.convertToList(clothesBean_i.cartclothes)}" var="c"> <tr> <td class="CartThumb" style=""> <img src="" /> </td> <td class="ProductName" colspan="1"> <h5></h5> <br /> </td> <td align="center" class="CartItemIndividualPrice"> $ #{c.price} </td> <td id="qt" align="center" class="CartItemIndividualPrice"> <h:outputLabel for="ajaxSpinner" value="" /> <p:outputPanel id="mypanel"> <p:spinner id="ajaxSpinner" value="#{clothesBean_i.qt}" min="1" max="100"> <p:ajax update="tot grandT" process="#this" /> </p:spinner> </p:outputPanel> </td> <td align="center" class="CartItemIndividualPrice"> <h:outputText id="tot" value="$ #{clothesBean_i.getClothePriceQt(c)}" /> </td> </tr> </ui:repeat> </tbody> <tfoot > <tr class="SubTotal GrandTotal"> <td colspan="4">Grand Total:</td> <td > <h:outputText id="grandT" value="$ #{clothesBean_i.getClothesPrice(clothesBean_i.convertToList(clothesBean_i.cartclothes))}" /> </td> </tr> </tfoot> </table> </h:form> in this line <p:ajax update="tot grandT" process="#this" /> when I give just one id (tot or grandT) it works fine, but with two ids I just get a blank page (nothing is showing)!
Dummy image when the datalist column is empty
Am using a datalist to show the product details. In this time i want to show the image, but it displayed when the image filed having the image path, otherwise it's empty. I want to show the dummy image when the field is empty.. Here is my code: <asp:DataList ID="DataList1" CaptionAlign="Right" runat="server" Width="100%" Visible="true" > <ItemTemplate> <table width="100%" border="0" cellspacing="5" cellpadding="0"> <tr> <td width="2%"> </td> <td> <div class="Curved_box"> <div class="curved_Top"> <div class="curved_TopLft"> </div> <div class="curved_TopRft"> </div> </div> <div class="CurvedContent"> <a href="#"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="width: 14px; height: 65px;"> </td> <td style="width: 113px; height: 65px;"> <asp:Image ID="Image1" Style="border: solid 1px #eaeaea; background: " runat="server" Height="60px" Width="60px" ImageUrl='<%#Bind("fldpic") %>' /> </td> <td width="80%" align="right" style="height: 65px"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="2" style="height: 20px" align="left"> <asp:Label ID="lbl_name" runat="server" Font-Bold="true" Text='<%#Bind("name") %>'></asp:Label> </td> </tr> <tr> <td style="width: 247px; height: 20px;" align="left"> <asp:Label ID="lblProd_Keywd" runat="server" Text='<%# Bind("Desig") %>' Font-Bold="True"></asp:Label> </td> <td align="left" style="height: 20px"> <asp:Label ID="lblProd_Code" runat="server" Text='<%# Bind("fldempid") %>' Font-Bold="True"></asp:Label> </td> </tr> <tr> </tr> </table> </td> </tr> </table> </a> </div> <div class="curved_Btm"> <div class="curved_BtmLft"> </div> <div class="curved_BtmRft"> </div> </div> </div> </td> <td width="2%"> </td> </tr> </table> </ItemTemplate> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" HorizontalAlign="Left" ForeColor="White" /> </asp:DataList>
add onerror attribute on <asp:Image> tag like onerror="this.src = 'url of dummy image'" change this mark up <asp:Image ID="Image1" Style="border: solid 1px #eaeaea; background: " runat="server" Height="60px" Width="60px" ImageUrl='<%#Bind("fldpic") %>' /> to <asp:Image ID="Image1" Style="border: solid 1px #eaeaea; background: " runat="server" Height="60px" Width="60px" ImageUrl='<%#Bind("fldpic") %>' onerror="this.src = 'url of dummy image'" />
Images in an email is not displaying in IE
I have created an HTML email for a client, who then asked me to post it to their server for viewing on the web. It is a basic table layout with images and some links. Everything appears to work in all major email clients, as well as Chrome, Safari, and Firefox. However, All versions of IE simply do not display the images. You can see the site here. http://poweredbyprofessionals.com/email/2012-10-MRF/ I verified that the images are RGB and not CMYK, as well as ran it through a validator. Nothing seems to fix the issue. Any ideas?
Solution Replace width="auto" and height="auto" by the real width and height. Demo http://jsfiddle.net/yrVsL/1/ Code modified <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <table style="border-collapse: collapse;" align="center" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" align="center"> <font color="#005697" style="font-family:Arial, Helvetica, sans-serif; font-size:18px; line-height:36px;"> <strong> Join Us!! <br/></strong> </font> <font color="#008754" style="font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px;"> <strong>Wings of Hope for Melanoma</strong><br /> a fundraising gala to benefit the <br /> Melanoma Research Foundation<br /><br /> </font> <font color="#000" style="font-family:Arial, Helvetica, sans-serif; font-size:14px; line-height:20px;"> <strong> Thursday, October 11, 2012<br/> 6:00 PM to 10:00 PM<br /> Gotham Hall <br /> 1356 Broadway, New York<br /><br /> </strong> <strong>Click here for more information, to purchase tickets or make a donation!</strong> </font> </td> </tr> <tr> <td> <a href="http://www.poweredbyprofessionals.com/melanoma/Purchase.html" target="_blank"> <img style="display: block;" src="http://poweredbyprofessionals.com/email/2012-10-MRF/images/Slice-1.jpg" alt="Slice-1" width="550" height="257" /> </a> </td> </tr> <tr> <td> <img style="display: block;" src="http://poweredbyprofessionals.com/email/2012-10-MRF/images/Slice-2.jpg" alt="Slice-2" width="550" height="446" /> </td> </tr> <tr> <td> <table style="border-collapse: collapse;" align="center" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img style="display: block;" src="http://poweredbyprofessionals.com/email/2012-10-MRF/images/Slice-4.jpg" alt="Slice-4" width="275" height="99" /> </td> <td> <a href="http://www.poweredbyprofessionals.com/melanoma/Purchase.html" target="_blank"> <img style="display: block;" src="http://poweredbyprofessionals.com/email/2012-10-MRF/images/Slice-3.jpg" alt="Slice-3" width="275" height="99" /> </a> </td> </tr> </table> </td> </tr> <tr> <td> <img style="display: block;" src="http://poweredbyprofessionals.com/email/2012-10-MRF/images/Slice-5.jpg" alt="Slice-5" width="550" height="319" /> </td> </tr> <tr> <td> <img style="display: block;" src="http://poweredbyprofessionals.com/email/2012-10-MRF/images/Slice-6.jpg" alt="Slice-2" width="550" height="99" /> </td> </tr> <tr> <td> <a href="http://www.poweredbyprofessionals.com/melanoma/Purchase.html" target="_blank"> <img style="display: block;" src="http://poweredbyprofessionals.com/email/2012-10-MRF/images/Slice-7.jpg" alt="Slice-1" width="550" height="99" /> </a> </td> </tr> <tr> <td> <table style="border-collapse: collapse;" align="center" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <a href="http://www.poweredbyprofessionals.com" target="_blank"> <img style="display: block;" src="http://poweredbyprofessionals.com/email/2012-10-MRF/images/Slice-8.jpg" alt="Slice-3" width="180" height="87" /> </a> </td> <td> <a href="http://www.melanoma.org" target="_blank"> <img style="display: block;" src="http://poweredbyprofessionals.com/email/2012-10-MRF/images/Slice-9.jpg" alt="Slice-3" width="180" height="87" /> </a> </td> <td> <a href="http://www.stanadler.com" target="_blank"> <img style="display: block;" src="http://poweredbyprofessionals.com/email/2012-10-MRF/images/Slice-10.jpg" alt="Slice-3" width="180" height="87" /> </a> </td> </tr> </table> </td> </tr> </table> </body> </html>
PrimeFaces Ajax
I am trying to make login with jsf. I want to hide login panel when user registered. I did this with jsf ajax. When I try to do this with primefaces. I am failed. I triy in jsf ajax like this. <h:form id="register"> <table style="width: 49%; margin-right: auto; margin-left: auto;"> <tr> <td colspan="3"> All fields are required.</td> </tr> <tr> <td class="style2" style="height: 51px">Username</td> <td style="width: 17px; height: 51px;">:</td> <td class="style3" style="height: 51px"><h:inputText id="regusername" style="width:155px;height:24px;" value="#{userRegister.regUser.username}"> </h:inputText></td> </tr> <tr> <td class="style2" style="height: 51px">Name</td> <td style="width: 17px; height: 51px;">:</td> <td class="style3" style="height: 51px"><h:inputText id="regname" style="width:155px;height:24px;" value="#{userRegister.regUser.name}"> </h:inputText></td> </tr> <tr> <td class="style2" style="height: 51px">Mail</td> <td style="width: 17px; height: 51px;">:</td> <td class="style3" style="height: 51px"><h:inputText id="regmail" style="width:155px;height:24px;" value="#{userRegister.regUser.mail}"> </h:inputText></td> </tr> <tr> <td class="style2" style="height: 51px">Password</td> <td style="width: 17px; height: 51px;">:</td> <td class="style3" style="height: 51px"> <h:inputSecret id="regpassword" style="width:155px;height:24px;" value="#{userRegister.regUser.password}"> </h:inputSecret></td> </tr> <tr> <td> </td> <td> </td> <td class="style3"><h:commandButton style="width:76px;height:26px" value="Clear" type="reset"> </h:commandButton> <h:commandButton style="width:75px;height:26px" value="Register" action="#{userRegister.register()}" method="post"> <f:ajax execute="regname regusername regpassword regmail" render="registermessage" /> </h:commandButton></td> </tr> <tr> <td colspan="3"><h:outputText id="registermessage" value="#{userRegister.message}"></h:outputText></td> </tr> </table> </h:form> </h:panelGroup> <h:panelGroup rendered="#{userLogin.isLoggedin()== true}" layout="block"> You are already loggedin !! </h:panelGroup> When ı try this in primefaces like this: <p:panel id ="registerPanel" header="User Registration" align="center" style="text-align:center;"> <table style="width: auto; margin: auto;"> <tr> <td style="text-align: right;"><h:outputLabel for="regname" value="Name Surname : * " /></td> <td style="text-align: left"><p:inputText id="regname" value="#{userRegister.regUser.name}" size="40" required="true" label="Name and Surname"> <f:validateLength minimum="2" /> </p:inputText> <p:watermark for="regname" value="Name Surname" /></td> </tr> <tr> <td style="text-align: right" colspan="2"><p:message for="regname" /></td> </tr> <tr> <td style="text-align: right;"><h:outputLabel for="regusername" value="Username : * " /></td> <td style="text-align: left"><p:inputText id="regusername" value="#{userRegister.regUser.username}" size="40" required="true" label="Username"> <f:validateLength minimum="3" /> </p:inputText> <p:watermark for="regusername" value="Username" /></td> </tr> <tr> <td style="text-align: riht" colspan="2"><p:message for="regusername" /></td> </tr> <tr> <td style="text-align: right;"><h:outputLabel for="regmail" value="E-Mail : * " /></td> <td style="text-align: left"><p:inputText id="regmail" value="#{userRegister.regUser.mail}" size="40" required="true" label="Mail"> <f:validateLength minimum="2" /> </p:inputText> <p:watermark for="regmail" value="mail#example.com" /></td> </tr> <tr> <td style="text-align: right" colspan="2"><p:message for="regmail" /></td> </tr> <tr> <td style="text-align: right;"><h:outputLabel for="paswword" value="Password : * " /></td> <td style="text-align: left"><p:password id="regpassword" value="#{userRegister.regUser.password}" size="40" required="true" label="Password"> <f:validateLength minimum="5" /> </p:password> <p:watermark for="regpassword" value="Password" /></td> </tr> <tr> <td style="text-align: left" colspan="2"><p:message for="regpassword" /></td> </tr> <tr> <td style="text-align: right" colspan="2"> </td> </tr> <tr> <td style="text-align: right" colspan="2"> <p:commandButton value="Clear" image="ui-icon ui-icon-arrowrefresh-1-w" type="reset"/> <p:commandButton value="Register" image="ui-icon ui-icon-disk" action="#{userRegister.register()}" method="post"> <f:ajax render="registerpaneli" /> </p:commandButton> </td> </tr> </table> --> </h:panelGroup> I registraion panel cant hiden. What is the problem ?
Remove the <p:commandButton ....> <f:ajax render="what-ever"> </p:commandButton> By <p:commandButton update="what-ever" ../> Furthermore, you can read Primefaces' Document and its demo. Because in Primefaces, most components are compatible with Ajax, especially <p:commandButton/> because it has Ajax turned on by default.
In PrimeFaces, <p:commandButton> already has built-in ajax functionality. You don't need to use <f:ajax>. In fact, <f:ajax> cannot be used with PrimeFaces. If you really need to use it, you must use <p:ajax> instead. To fix your issue, I think you should change you button like this: <p:commandButton value="Register" actionListener="#{userRegister.register}" update="registerPanel" />