jQuery NextUntil like function for phpQuery - phpquery

Is there any jQuery NextUntil function for phpQuery?
In case I have this HTML structure:
<table id="m" width="100%">
<tbody>
<tr class="x" align="center"></tr>
<tr></tr>
<tr class="n"></tr>
<tr></tr>
<tr class="n"></tr>
<tr></tr>
<tr class="x" align="center"></tr>
<tr class="n"></tr>
<tr></tr>
<tr class="n"></tr>
<tr></tr>
<tr class="n"></tr>
<tr></tr>
</tbody>
</table>
All I want to do is getting the elements between "tr.x" using phpQuery. In jQuery we can do that with NextUntil() function.

I think this will work for your purposes:
$i = 0;
foreach($children as $child){
if($i == 2){ break; }
$i = (pq($child)->attr('class') == 'x') ? ($i + 1) : $i;
if($i == 0){ continue; }
echo pq($child)->text();
}
note: this will also exclude all tr elements before the first tr.x
for example if the html was..
<tbody>
<tr class="n">h</tr>
<tr class="x" align="center">a</tr>
<tr>b</tr>
<tr class="n">c</tr>
<tr>d</tr>
<tr class="n">e</tr>
<tr>f</tr>
<tr class="x" align="center">g</tr>
<tr class="n">h</tr>
<tr></tr>
<tr class="n"></tr>
<tr></tr>
<tr class="n"></tr>
<tr></tr>
</tbody>
the output would be
a
b
c
d
e
f
g
hope that helps

Related

Rendering a dictionary in a template

While rendering values of a dictionary in a template, some values are showed outside the html table. I cant realize why.
Any ideas?
Thanks in advance,
#This is how the dictionary is printed in console
[{'socio': 'Randazzo Walter Ariel 25', 'enero': 'P', 'febrero': 'P', 'marzo': 'P', 'abril': 'P', 'mayo': 'P', 'junio': 'P', 'julio': 'P', 'agosto': 'P', 'septiembre': 'P', 'octubre': 'P', 'noviembre': 'P', 'diciembre': 'P'}, {'socio': 'Silvi Edgardo Marcelo 31', 'enero': 'P', 'febrero': 'P', 'marzo': 'P', 'abril': 'P', 'mayo': 'P', 'junio': 'P', 'julio': '-', 'agosto': '-', 'septiembre': '-', 'octubre': '-', 'noviembre': '-', 'diciembre': '-'}]
#this is how the template is rendered
#Template:
<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Listados</title>
<style>
* {
color: black;
}
body {
font-family: "Roboto", "Lucida Grande", Verdana, Arial, sans-serif;
padding: 0;
margin: 0;
color: black;
}
.name-company {
font-size: 30px;
padding: 0;
margin: 0;
font-weight: bold;
text-transform: uppercase;
text-align: center;
}
table thead tr th {
border: 1px solid black !important;
padding: 3px;
}
table tbody tr td {
border: 1px solid black;
padding: 3px;
}
.img-logo {
margin-top: 10px;
width: 75px;
height: 75px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<img src="{{ icon }}" width="140" height="32" style="text-align: right;">
<p style="text-align: right;margin-top: 2px;">
</p>
<br>
<p style="text-align: left;margin-top: 2px;">
Año: {{ano}}
</p>
<br>
<div class="container-fluid">
<table class="table" style="width: 100%;">
<thead>
<tr style="border: 1px solid black;">
<th style="width: 30%; text-align: center;">SOCIO</th>
<th style="width: 25%; text-align: center;">ENE</th>
<th style="width: 25%; text-align: center;">FEB</th>
<th style="width: 25%; text-align: center;">MAR</th>
<th style="width: 25%; text-align: center;">ABR</th>
<th style="width: 25%; text-align: center;">MAY</th>
<th style="width: 25%; text-align: center;">JUN</th>
<th style="width: 25%; text-align: center;">JUL</th>
<th style="width: 25%; text-align: center;">AGO</th>
<th style="width: 25%; text-align: center;">SEP</th>
<th style="width: 25%; text-align: center;">OCT</th>
<th style="width: 25%; text-align: center;">NOV</th>
<th style="width: 25%; text-align: center;">DIC</th>
</tr>
</thead>
<tbody>
{% for pago in pagos %}
<tr {% if forloop.first %}style="padding-top: 3px;" {% endif %}>
<td class="text-center">{{ pago.socio }}</td>
<td class="text-center">{{ pago.enero }}</td>
<td class="text-center">{{ pago.febrero }}</td>
<td class="text-center">{{ pago.marzo }}</td>
<td class="text-center">{{ pago.abril }}</td>
<td class="text-center">{{ pago.mayo }}</td>
<td class="text-center">{{ pago.junio }}</td>
<td class="text-center">{{ pago.julio }}</td>
<td class="text-center">{{ pago.agosto }}</td>
<td class="text-center">{{ pago.septiembre }}</td>
<td class="text-center">{{ pago.octubre }}</td>
<td class="text-center">{{ pago.noviembre }}</td>
<td class="text-center">{{ pago.diciembre }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</body>
</html>
#view
def get(self,request,*args,**kwargs):
anolistado = self.kwargs['ano']
listainfopagosanual=[]
sociosdet=[]
#devuelve el numero de socio
def numerodesocio(soc):
nrosocio=""
for c in soc:
if c.isnumeric():
nrosocio+=c
return nrosocio
#Lista de socios con pagos
pagosdet=PagosDetail.objects.all().select_related('pago').filter( ano_pago=anolistado).order_by('pago__numero_socio__numero_socio')
for det in pagosdet:
if str(det.pago.numero_socio) not in sociosdet:
sociosdet.append(str(det.pago.numero_socio))
#Por cada socio guardo los meses pagos
for soc in sociosdet:
nrosocio=numerodesocio(soc)
pagosdet1=PagosDetail.objects.all().select_related('pago').filter( ano_pago=anolistado,pago__numero_socio=nrosocio)
EneroPago="-";FebreroPago="-";MarzoPago="-";AbrilPago="-";MayoPago="-";JunioPago="-";JulioPago="-";AgostoPago="-";SeptiembrePago="-";OctubrePago="-";NoviembrePago="-";DiciembrePago="-"
for det in pagosdet1:
mespago=str(det.mes_pago)
if mespago=="Enero":
EneroPago="P"
if mespago=="Febrero":
FebreroPago="P"
if mespago=="Marzo":
MarzoPago="P"
if mespago=="Abril":
AbrilPago="P"
if mespago=="Mayo":
MayoPago="P"
if mespago=="Junio":
JunioPago="P"
if mespago=="Julio":
JulioPago="P"
if mespago=="Agosto":
AgostoPago="P"
if mespago=="Septiembre":
SeptiembrePago="P"
if mespago=="Octubre":
OctubrePago="P"
if mespago=="Noviembre":
NoviembrePago="P"
if mespago=="Diciembre":
DiciembrePago="P"
listainfopagosanual.append({'socio':soc,'enero':EneroPago,'febrero':FebreroPago,'marzo':MarzoPago,'abril':AbrilPago,'mayo':MayoPago,'junio':JunioPago,'julio':JulioPago,'agosto':AgostoPago,'septiembre':SeptiembrePago,'octubre':OctubrePago,'noviembre':NoviembrePago,'diciembre':DiciembrePago})
print (listainfopagosanual)
try:
template= get_template('socios/invoice_socioscuotas_anual.html')
context={
'ano': anolistado,
'pagos': listainfopagosanual,
'icon': '{}{}'.format(settings.STATIC_URL,'core/img/adicrareng.jpg'),
}
html=template.render(context)
response= HttpResponse(content_type='application/pdf')
pisaStatus=pisa.CreatePDF(html, dest=response,link_callback=self.link_callback)
return response
except Exception as ex:
print(ex)
return HttpResponse(reverse_lazy('pagos:list'))
#Models
class Socios(models.Model):
numero_socio = models.AutoField(primary_key=True)
nombre = models.CharField(max_length=50)
apellido = models.CharField(max_length=50)
tipo_documento = models.CharField(max_length=3, choices=tipos_documento, default ='DNI')
documento = models.CharField(max_length=50)
fecha_nacimiento = models.DateField(null=True,blank=True)
nacionalidad = models.CharField(max_length=50)
status = models.CharField(max_length=1,choices=lista_status,default='Activo')
domicilio = models.CharField(max_length=50)
localidad = models.CharField(max_length=50)
provincia = models.CharField(max_length=2, choices=lista_provincia, default ='2')
codigo_postal = models.CharField(max_length=50)
celular = models.CharField(max_length=50)
telefono_fijo = models.CharField(max_length=50, null=True)
twitter = models.CharField(max_length=50, null=True)
facebook = models.CharField(max_length=100, null=True)
linkedin = models.CharField(max_length=100, null=True)
fecha_ingreso = models.DateField(default=datetime.now,null=False,blank=False)
email = models.EmailField(null=True)
titulo = models.CharField(max_length=100,null=True)
institucion = models.CharField(max_length=150,null=True)
class PagosHead(models.Model):
numero_pago = models.IntegerField()
numero_socio = models.ForeignKey(Socios, on_delete=models.CASCADE)
fecha_pago = models.DateField(default=datetime.now,null=True,blank=True)
importe_pago_total = models.DecimalField(default=0.00,max_digits=9,decimal_places=2)
observaciones_pago = models.CharField(max_length=100,null=True)
numero_factura=models.CharField(max_length=14,default="00000-00000000",null=True,blank=True)
class PagosDetail(models.Model):
pago=models.ForeignKey(PagosHead,on_delete=models.CASCADE)
importe_pago = models.DecimalField(default=0.00,max_digits=9,decimal_places=2)
mes_pago = models.CharField(max_length=10)
ano_pago = models.SmallIntegerField(null=True)
#Final Rendered html Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Listados</title>
<style>
* {
color: black;
}
body {
font-family: "Roboto", "Lucida Grande", Verdana, Arial, sans-serif;
padding: 0;
margin: 0;
color: black;
}
.name-company {
font-size: 30px;
padding: 0;
margin: 0;
font-weight: bold;
text-transform: uppercase;
text-align: center;
}
table thead tr th {
border: 1px solid black !important;
padding: 3px;
}
table tbody tr td {
border: 1px solid black;
padding: 3px;
}
.img-logo {
margin-top: 10px;
width: 75px;
height: 75px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<img src="/static/core/img/adicrareng.jpg" width="140" height="32" style="text-
align: right;">
<p style="text-align: right;margin-top: 2px;">
</p>
<br>
<p style="text-align: left;margin-top: 2px;">
Año: 2020
</p>
<br>
<div class="container-fluid">
<table class="table" style="width: 100%;">
<thead>
<tr style="border: 1px solid black;">
<th style="width: 30%; text-align: center;">SOCIO</th>
<th style="width: 25%; text-align: center;">ENE</th>
<th style="width: 25%; text-align: center;">FEB</th>
<th style="width: 25%; text-align: center;">MAR</th>
<th style="width: 25%; text-align: center;">ABR</th>
<th style="width: 25%; text-align: center;">MAY</th>
<th style="width: 25%; text-align: center;">JUN</th>
<th style="width: 25%; text-align: center;">JUL</th>
<th style="width: 25%; text-align: center;">AGO</th>
<th style="width: 25%; text-align: center;">SEP</th>
<th style="width: 25%; text-align: center;">OCT</th>
<th style="width: 25%; text-align: center;">NOV</th>
<th style="width: 25%; text-align: center;">DIC</th>
</tr>
</thead>
<tbody>
<tr style="padding-top: 3px;" >
<td class="text-center">Randazzo Walter Ariel 25</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
</tr>
<tr >
<td class="text-center">Silvi Edgardo Marcelo 31</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">-</td>
<td class="text-center">-</td>
<td class="text-center">-</td>
<td class="text-center">-</td>
<td class="text-center">-</td>
<td class="text-center">-</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
I have modified a the structure of the data from list of dictionaries to a dictionary.
#Now This is how the dictionary is printed in console
{'25': {'socio': 'Randazzo Walter Ariel 25', 'enero': 'P', 'febrero': 'P', 'marzo': 'P', 'abril': 'P', 'mayo': 'P', 'junio': 'P', 'julio': 'P', 'agosto': 'P', 'septiembre': 'P', 'octubre': 'P', 'noviembre': 'P', 'diciembre': 'P'}, '31': {'socio': 'Silvi Edgardo Marcelo 31', 'enero': 'P', 'febrero': 'P', 'marzo': 'P', 'abril': 'P', 'mayo': 'P', 'junio': 'P', 'julio': '-', 'agosto': '-', 'septiembre': '-', 'octubre': '-', 'noviembre': '-', 'diciembre': '-'}}
This is how I populate the dictionary:
dictinfopagosanual[nrosocio]={'socio':soc,
'enero':EneroPago,
'febrero':FebreroPago,
'marzo':MarzoPago,
'abril':AbrilPago,
'mayo':MayoPago,
'junio':JunioPago,
'julio':JulioPago,
'agosto':AgostoPago,
'septiembre':SeptiembrePago,
'octubre':OctubrePago,
'noviembre':NoviembrePago,
'diciembre':DiciembrePago,
}
Then I render in the template as follow:
<tbody>
{% for key,value in pagos.items %}
<tr {% if forloop.first %}style="padding-top: 3px;" {% endif %}>
{% for key,value in value.items %}
<td class="text-center">{{ value }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>

Regex not matching exact string

Ihrer Bestellung auf Contorion.de verschickt wurde. Bitte entnehmen Sie genauere Informationen der unten stehenden Auflistung. </p></th><th class="expander" style="padding:0!important;visibility:hidden;width:0"></th></tr></table></th><th class="show-for-large valign-top last columns large-6 small-12" style="Margin:0 auto;margin:0 auto;padding-bottom:0;padding-left:10px;padding-right:0!important;vertical-align:top;width:300px"><table style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><th><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td height="20" colspan="3" class="_bt _bl _br" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;border-left:solid 1px #ccc!important;border-right:solid 1px #ccc!important;border-top:solid 1px #ccc!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td width="20" class="_bl" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;border-left:solid 1px #ccc!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>Bestelldatum:</strong> 19.08.2019<br><strong>Bestellnummer:</strong> DE605812349<br><strong>Kundennummer:</strong> DE2002778724<br></p><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left">Bei Rückfragen bitte Bestellnummer angeben.</p></td><td width="20" class="_br" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;border-right:solid 1px #ccc!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td height="10" colspan="3" class="_bb _bl _br" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-bottom:solid 1px #ccc!important;border-collapse:collapse!important;border-left:solid 1px #ccc!important;border-right:solid 1px #ccc!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table></td></tr></tbody></table></th><th class="expander" style="padding:0!important;visibility:hidden;width:0"></th></tr></table></th></tr></tbody></table></td></tr></table></td><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table><table cellspacing="0" cellpadding="0" class="hide-for-large" style="border-collapse:collapse;border-spacing:0;display:none;font-size:0;height:0;line-height:0;max-height:0;mso-hide:all;overflow:hidden;width:0"><tr style="mso-hide:all"><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;mso-hide:all;width:100%"><tr style="mso-hide:all"><td height="20" colspan="3" class="_bt _bl _br" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;border-left:solid 1px #ccc!important;border-right:solid 1px #ccc!important;border-top:solid 1px #ccc!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr style="mso-hide:all"><td width="20" class="_bl" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;border-left:solid 1px #ccc!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;mso-hide:all;text-align:left"><strong style="mso-hide:all">Bestelldatum:</strong> 19.08.2019<br style="mso-hide:all"><strong style="mso-hide:all">Bestellnummer:</strong> DE605812349<br style="mso-hide:all"><strong style="mso-hide:all">Kundennummer:</strong> DE2002778724<br style="mso-hide:all"></p><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;mso-hide:all;text-align:left">Bei Rückfragen bitte Bestellnummer angeben.</p></td><td width="20" class="_br" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;border-right:solid 1px #ccc!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr style="mso-hide:all"><td height="10" colspan="3" class="_bb _bl _br" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-bottom:solid 1px #ccc!important;border-collapse:collapse!important;border-left:solid 1px #ccc!important;border-right:solid 1px #ccc!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table></td></tr><tr style="mso-hide:all"><td height="15" colspan="3" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td height="15" colspan="3" class="_bb" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-bottom:solid 1px #ccc!important;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td height="15" colspan="3" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table> <table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td colspan="3" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table class style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><th class="valign-top first columns large-6 small-12" style="Margin:0 auto;margin:0 auto;padding-bottom:0;padding-left:0!important;padding-right:10px;vertical-align:top;width:300px"><table style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><th><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellspacing="0" cellpadding="0" class="button primary" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td height="32" width="2" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><img src="http://media.contorion.de/content/mails/btn/btn_left.png" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:left;max-width:100%;outline:0;text-decoration:none;width:auto"></td><td height="32" class="valign-middle text-center button__bg" bgcolor="#60b0ff" align="center" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#60b0ff;border-collapse:collapse!important;color:#fff;hyphens:auto;padding:0;text-align:center;vertical-align:middle;word-wrap:break-word"><table style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td class="text-center" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#60b0ff;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:center;vertical-align:top;word-wrap:break-word">Sendung verfolgen</td></tr></table></td><td height="32" width="7" class="button__bg button__arrow" bgcolor="#60b0ff" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#60b0ff;border-collapse:collapse!important;color:#fff;hyphens:auto;padding:0;text-align:left;vertical-align:middle;word-wrap:break-word"><img src="http://media.contorion.de/content/mails/btn/icon_arrow_btn.jpg" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:left;max-width:100%;outline:0;text-decoration:none;width:auto"></td><td width="10" height="30" class="button__bg" bgcolor="#60b0ff" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#60b0ff;border-collapse:collapse!important;color:#fff;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td height="32" width="2" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><img src="http://media.contorion.de/content/mails/btn/btn_right.png" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:left;max-width:100%;outline:0;text-decoration:none;width:auto"></td></tr></table></td></tr><tr><td height="15" colspan="2" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>Rechnungsvermerk:</strong></p></td><td class="hide-for-large" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;display:none;font-size:0;height:0;hyphens:auto;line-height:0;max-height:0;mso-hide:all;overflow:hidden;padding:0;text-align:left;vertical-align:top;width:0;word-wrap:break-word"><p class="float-right" style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;mso-hide:all;text-align:left">7740/PC-IMT</p></td></tr></tbody></table></td></tr><tr><td height="10" colspan="99" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr class="show-for-large"><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left">7740/PC-IMT</p></td></tr><tr><td height="15" colspan="99" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></tbody></table></th><th class="expander" style="padding:0!important;visibility:hidden;width:0"></th></tr></table></th><th class="valign-top columns large-6 small-12" style="Margin:0 auto;margin:0 auto;padding-bottom:0;padding-left:10px;padding-right:10px;vertical-align:top;width:300px"><table style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><th><table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td class="valign-middle" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:middle;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>Versendet mit</strong></p></td><td class="hide-for-large" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;display:none;font-size:0;height:0;hyphens:auto;line-height:0;max-height:0;mso-hide:all;overflow:hidden;padding:0;text-align:left;vertical-align:top;width:0;word-wrap:break-word"><img width="56" height="30" class="float-right" src="https://media.contorion.de/content/mails/order/GLS.jpg" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:right;max-width:100%;mso-hide:all;outline:0;text-align:right;text-decoration:none;width:auto"></td></tr></tbody></table></td></tr><tr class="show-for-large"><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><img width="56" height="30" src="https://media.contorion.de/content/mails/order/GLS.jpg" style="-ms-interpolation-mode:bicubic;clear:both;display:block;max-width:100%;outline:0;text-decoration:none;width:auto"></td></tr> <tr><td height="15" colspan="2" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>Sendungsnr.</strong></p></td><td class="hide-for-large" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;display:none;font-size:0;height:0;hyphens:auto;line-height:0;max-height:0;mso-hide:all;overflow:hidden;padding:0;text-align:left;vertical-align:top;width:0;word-wrap:break-word"><p class="float-right" style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;mso-hide:all;text-align:left">25147184307</p></td></tr></tbody></table></td></tr><tr><td height="10" colspan="99" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr class="show-for-large"><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left">25147184307</p></td></tr></tbody></table></th><th class="expander" style="padding:0!important;visibility:hidden;width:0"></th></tr></table></th><th class="valign-top last columns large-6 small-12" style="Margin:0 auto;margin:0 auto;padding-bottom:0;padding-left:10px;padding-right:0!important;vertical-align:top;width:300px"><table style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><th><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>Lieferadresse</strong></p></td></tr><tr><td height="5" colspan="1" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left">Böllhoff Produktion GmbH<br> Product Center Injection Moulding Technology (PC IMT)<br>Sachbearbeitung Materialwirtschaft<br> Archimedesstr. 1-4 <br>33649 Bielefeld</p></td></tr></table></td><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table></th><th class="expander" style="padding:0!important;visibility:hidden;width:0"></th></tr></table></th></tr></tbody></table></td><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td height="15" colspan="3" class="_bb" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-bottom:solid 1px #ccc!important;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td height="15" colspan="3" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></tbody></table><table cellpadding="0" cellspacing="0" class="container" style="Margin:0!important;border-collapse:collapse;border-spacing:0;display:table;margin:0!important;text-align:inherit;width:640px"><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td width="23" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><img width="23" height="23" src="https://media.contorion.de/content/mails/order/info-icon.png" style="-ms-interpolation-mode:bicubic;clear:both;display:block;max-width:100%;outline:0;text-decoration:none;width:auto"></td><td width="10" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"> Die Sendung wurde mit GLS Paket versandt. Wenn Sie diese Sendung verfolgen möchten, benutzen Sie bitte diese Paketverfolgungsnummer: 25147184307. Diese Mail bestätigt, dass Ihr Paket an den Pakendienstleister übergeben wurde. Nach der Übergabe kann es bis zu 12 Stunden dauern, bis das Paket im Paketzentrum gescannt wird und weitere Informationen zur Sendungsverfolgung über obigen Link abrufbar sind.</p></td></tr></table></td><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td height="20" colspan="99" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr> <!-- Shipments --><tr><td colspan="3" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table class="_bt _br _bl" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-left:solid 1px #ccc!important;border-right:solid 1px #ccc!important;border-spacing:0;border-top:solid 1px #ccc!important;display:table;width:100%"><tr><td height="15" colspan="3" class="bg-gray" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#f3f3f3;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td class="bg-gray" width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#f3f3f3;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td class="bg-gray" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#f3f3f3;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p class="nomargin" style="Margin:0!important;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0!important;margin-bottom:0!important;margin-top:0!important;text-align:left"><strong>Ihre Teillieferung</strong></p></td><td class="bg-gray" width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#f3f3f3;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td height="15" colspan="3" class="bg-gray" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#f3f3f3;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td height="15" colspan="3" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td colspan="3" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td width="70" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><img width="42" height="42" src="http://media.contorion.de/media/images/products/din-1440-flache-scheibe-edelstahl-a4-12mm-produktklasse-a-91368379-0-rGZGVmCY-s.jpg" style="-ms-interpolation-mode:bicubic;clear:both;display:block;max-width:100%;outline:0;text-decoration:none;width:auto"></td><td width="10" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>DIN 1440 Flache Scheibe Edelstahl A4 12mm Produktklasse A</strong></p></td><td width="10" class="show-for-large" font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>DIN 316 Flügelschraube amerikansiche Form M10x50 Edelstahl A2 blank</strong></p></td><td width="10" class="show-for-large" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!importantA233hov39YG3zxPW4unCSHAcWReP8A2hzLqM"></body></html>
I have this HTML where I am meant to match the articles/product items.
Here is the regex: <strong>(.*?)<\/strong><\/p><\/td><td width="10"
The second article matches perfectly, but the first one is matching too much and I need an exact match. <\/p><\/td><td width="10" should come exactly after </strong> but it is matching it way down the page.
I've tried using ^...$ but it isn't working for some reason..
this is slow, but instead of matching everything inside the tag as you currently do .*?, you could insert a negative lookahead (?!<strong>) and match everything . except for characters followed by the opening tag you want to avoid, here <strong>
<strong>((.(?!<strong>))*?)<\/strong><\/p><\/td><td width="10"
this prevents the regex from matching any additional <strong> tags after the first matched one
if you want to prevent creating an additional group from the newly added parenthesis, you can make the inner part non-capturing
((?:.(?!<strong>))*?)

coldfusion replace function not working correctly

Here is a document, stored in a variable called templlet:
{{d
{{h
Dear Customer,
We were so pleased that you have signed up for one of our programs. Below please find a listing of what you signed up for.
{{r
Sincerely Yours,
John Jones
President
XYZ Corporation
I intend to replace the {{d {{h and {{r with information selected by the user. {{d is a date, {{h is a heading and {{r is a report. The code to do this replacement is:
<cfset templlet = Replace(templlet, "{{d", "#repdatemm#")>
<cfset templlet = Replace(templlet, "{{h", "#heading#")>
<cfset templlet = Replace(templlet, "{{r", "#letrep#")>
The {{d and {{h are working fine. The {{r is being replaced with letrep, but not where it is positioned in templlet. Here is sample output:
July 06, 2018
Mr. Joseph Smith
1632 S. Bailey St.
Philadelphia, PA 19145
Dear Customer,
We were so pleased that you have signed up for one of our programs. Below please find a listing of what you signed up for.
Sincerely Yours,
John Jones
President
XYZ Corporation
Activity Code....Amount.....Note
EarlyReg.........500.00.....by check
Parking ...........30.00.......by paypal
Report Total :...530.00
(sorry for all the dots here -- I couldn't figure out how to put spaces in).
You can see that the {{r in templlet is prior to the signature, but the report is appearing after the signature line.
I've tried leaving more room in templlet between the {{r and the signature, which made no difference. I tried putting the {{r in a div, which made no difference. I'm baffled about why this is coming out in the wrong place. Can anyone tell me what is going wrong here?
The problem is that the:
<table>
Enclosing the report is not closed properly.
This works:
<cfsavecontent variable="content">
<link rel="stylesheet" href="sample.css"> <link rel="stylesheet" type = "text/css" href ="betty.css"/> <script type = "text/javascript"> fieldsplitput('moxlet', '�', 'x_1', 1) </script> <p style="margin-left:40px">{{d</p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">{{h</span></span></p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">Dear Customer,</span></span></p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">We were so pleased that you have signed up for one of our programs. Apparently you live in the city of Philadelphia. Additionally we observe that you were referred to us by 191. Below please find a listing of what you signed up for.</span></span></p> <div> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif"> <link rel="stylesheet" type = "text/css" href ="betty.css"/> <link rel="stylesheet" type = "text/css" href ="persrep.css"/> <style type="text/css"> #media print { table tr.page-break{page-break-before:always} } </style> <HTML> <head> <link rel="stylesheet" type = "text/css" href ="betty.css"/> </head> <body> </body> </html> <div style = "margin:auto;overflow:auto; " >{{r</span></span></p> </div> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">Sincerely Yours,</span></span></p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">John Jones<br /> President<br /> XYZ Corporation</span></span></p>
</cfsavecontent>
<cfset date = "July 06, 2018">
<cfsavecontent variable="header">
Mr. Joseph Smith<br />
1632 S. Bailey St.<br />
Philadelphia, PA 19145
</cfsavecontent>
<cfsavecontent variable="report">
<table class = "reptable" id = 'reptable' > <tr><td> </td></tr> <td> </td> <td class = "repcolhead1">Activity Code</td> <td class = "repcolhead1">Amount Paid</td> <td class = "repcolhead1">Note</td> <td><input type = "text" id = "repfoc" class = "inpbl" value = "" style = "lineheight: 2px; width:2px" > </td> </tr> <script type = "text/Javascript"> thefocus('repfoc') function thefocus(id) { //alert("got to thefocus id is " + id); document.getElementById(id).focus(); } </script> <td style = "padding-left: 0px; padding-top: 10px " class = "repsubh"> State: PA </td> <tr> <!--up counter on this subhead where appropriate ---> <td style = "padding-left: 10px; " class = "repsubh"> Trans. Date: 11-06-2017 </td> <!--up counter on this subhead where appropriate ---> <td class = "repcolrow" style = "color: #141212; text-align: left;" > EarlyReg </td> <td class = "repcolrow" style = "color: #141212; text-align: right;" > 500.00 </td> <td class = "repcolrow" style = "color: #141212; text-align: left;" > </td> <tr> <!--up counter on this subhead where appropriate ---> <td style = "padding-left:10px; vertical-align: middle; padding-top: 5px; padding-bottom:20px; " class = "repsubf"> Subtotal: 11-06-2017 </td> <!--up counter on this subhead where appropriate ---> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <script> placecount('cnt-2-1','cnt-2-2', 'brk-2-4-1', 'brk-2-4-2') </script> <td class = "repcolrow" style = "text-align: right;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> 500.00 </a> </td> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <tr> <td style = "padding-left:0px; vertical-align: middle; padding-top: 5px; padding-bottom:20px; " class = "repsubf"> Subtotal: PA </td> <!--up counter on this subhead where appropriate ---> <!--up counter on this subhead where appropriate ---> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <script> placecount('cnt-3-1','cnt-3-2', 'brk-3-4-1', 'brk-3-4-2') </script> <td class = "repcolrow" style = "text-align: right;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> 500.00 </a> </td> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <tr> <td class = 'repsubf' style = "font-weight:bold"> Report Total : <br> <a class = "repnum" id = "cnt-4-1" style = ""> Count : </a> <a class = "repnum" id = "cnt-4-2" style = "; ">1 </a> </p> </td> <td class = "repcolrow" style = "text-align: left;font-weight:bold; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <script> placecount('cnt-4-1','cnt-4-2', 'brk-4-4-1', 'brk-4-4-2') </script> <td class = "repcolrow" style = "text-align: right;font-weight:bold; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> 500.00 </a> </td> <td class = "repcolrow" style = "text-align: left;font-weight:bold; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <tr> <tr><td> </td></tr><table>
</cfsavecontent>
<cfset content = ReplaceNoCase(content,"{{d",date)>
<cfset content = ReplaceNoCase(content,"{{h",header)>
<cfset content = ReplaceNoCase(content,"{{r",report)>
<cfoutput>
#content#
</cfoutput>

mootools 1.4.0.1 - htmltable push

in according with
http://mootools.net/more/docs/1.5.1/Interface/HtmlTable#HtmlTable
I have used push to add new rows, with some properties and positioning.
Here a snippet:
var table = new HtmlTable($('my_table_id'));
var target = "some code...";
table.push([
td_val1,
td_val2,
td_val3,
td_val4,
{
content: td_val5,
properties: {
'class': 'my_class'
}
},
td_val6,
],
(target !== undefined) ? {} : null,
(target !== undefined) ? target.parentNode : null,
(target !== undefined) ? 'td' : null,
(target !== undefined) ? 'after' : null
);
It work well with a empty table like (table.empty() before push):
<table id="my_table_id">
<thead>
<tr>
<th>Col1</th>
<th>Col2</th>
<th>Col3</th>
<th>Col4</th>
<th>Col5</th>
<th>Col6</th>
<th>Col7</th>
<th>Col8</th>
</tr>
</thead>
<tbody>
<tr class="no_result">
<td colspan="8">No results</td>
</tr>
</tbody>
</table>
But no effect on a pre fill table like:
<table id="my_table_id">
<thead>
<tr>
<th>Col1</th>
<th>Col2</th>
<th>Col3</th>
<th>Col4</th>
<th>Col5</th>
<th>Col6</th>
<th>Col7</th>
<th>Col8</th>
</tr>
</thead>
<tbody>
<tr>
<td>val1</td>
<td>val2</td>
<td>val3</td>
<td>val4</td>
<td>val5</td>
<td>val6</td>
<td>val7</td>
<td>val8</td>
</tr>
</tbody>
</table>
The push code is in a try/catch, but no excepetion raised.
I no focused the problem what is... Thanks so much for help.

Knockoutjs list in a list select binding

I have seen so many example of this problem but not as a list. Here's my code:
<div>
<form>
<p>You have asked for <span data-bind='text: gifts().length'> </span> gift(s)</p>
<input id='giftname' type='text'/><button data-bind='click: createGift'>Add Gift</button>
<table>
<thead>
<tr>
<th>Gift name</th>
<th>Pack</th>
<th>Price</th>
<th />
</tr>
</thead>
<tbody data-bind='foreach: gifts'>
<tr>
<td><input data-bind='value: name' readonly='readonly'/></td>
<td><select data-bind="options: packs,
optionsText: 'pack',
value: price" /></td>
<td><input data-bind="value: price ? price.packprice : 'unknown'" readonly="readonly"/></td>
<td><a href='#' data-bind='click: $root.removeGift'>Delete</a></td>
</tr>
</tbody>
</table>
<button data-bind='enable: gifts().length > 0' type='submit'>Submit</button>
</form>
</div>
<script type="text/javascript">
var GiftModel = function(gifts) {
var self = this;
self.gifts = ko.observableArray(gifts);
self.addGift = function(gift) {
var newGift = {
name: gift.name,
packs: gift.packs,
price: gift.price
};
self.gifts.push(newGift);
};
self.removeGift = function(gift) {
self.gifts.remove(gift);
};
self.createGift = function() {
var gname = $('#giftname').val();
//should be getting gift options from webservice
var newGift = {name: gname,
packs: [{pack:'Each', packprice: '2'}, {pack:'Dozen', packprice: '12'}], price: {pack:'', packprice: ''}};
self.addGift(newGift);
$('#giftname').val('');
};
};
var viewModel = new GiftModel([]);
ko.applyBindings(viewModel);
</script>
When I add gifts, it creates options of packs. Each pack has a certain price. My problem is just simple. How will I show the price on the next column for the selected pack of the gift line? Sorry im just new to knockoutjs. Thanks!
System will automatically update price after selecting package if you make it observable. I made a little refactoring to you code, now it works:
<div>
<form>
<p>You have asked for <span data-bind='text: gifts().length'> </span> gift(s)</p>
<input
id='giftname' type='text' data-bind='value: giftName' />
<button data-bind='click: createGift'>Add Gift</button>
<table>
<thead>
<tr>
<th>Gift name</th>
<th>Pack</th>
<th>Price</th>
<th />
</tr>
</thead>
<tbody data-bind='foreach: gifts'>
<tr>
<td>
<input data-bind='value: name' readonly='readonly' />
</td>
<td>
<select data-bind="options: packs,
optionsText: 'pack',
optionsValue: 'packprice',
value: price" />
</td>
<td>
<input data-bind="value: price() || 'unknown'" readonly="readonly"
/>
</td>
<td><a href='#' data-bind='click: $root.removeGift'>Delete</a>
</td>
</tr>
</tbody>
</table>
<button data-bind='enable: gifts().length > 0' type='submit'>Submit</button>
</form>
</div>
function GiftModel(name) {
var self = this;
self.name = ko.observable(name);
self.price = ko.observable();
self.packs = ko.observable([{
pack: 'Each',
packprice: '2'
}, {
pack: 'Dozen',
packprice: '12'
}]);
}
var ViewModel = function (gifts) {
var self = this;
self.gifts = ko.observableArray(gifts);
self.giftName = ko.observable();
self.removeGift = function (gift) {
self.gifts.remove(gift);
};
self.createGift = function () {
self.gifts.push(new GiftModel(self.giftName()));
};
};
var viewModel = new ViewModel([]);
ko.applyBindings(viewModel);
Here is working fiddle: http://jsfiddle.net/vyshniakov/pzJaH/
P.S. Don't use jQuery to get field value if you using knockout. It is much easier to do this with knockout.