Is there a way to concatenate multilines in [onshow; if [var.x]!='0'; then ' multilines here ';else ''] - concatenation

How to concatenate multiline string in [onshow if then else] condition with tbs variables?
Thanks for your help.
I work on windows 10 + WAMP.
I had try the code bellow. I suppose the problem is coming from the tbs variables incuded in. I did'nt find the way to eliminate this error:
"TinyButStrong Error : can't found the end of the tag '[onshow; if [var.x...'.
TinyButStrong Error : can't found the end of the tag '[onshow; if [var.x...'.
TinyButStrong Error : can't found the end of the tag '[onshow; if 0!='0'...'.
TinyButStrong Error : can't found the end of the tag '[onshow; if 0!='0'...'."
[onshow; if [var.x_created_dupli]!='0'; then '<td>
<select name="x_exercise" size="10" onchange="chooseExercise();">
<option value="[blk_exercise.key]">[blk_exercise.val;block=option;strconv=utf8]'</option>
<option>[onshow.x_exercise;ope=html;select]</option>
</select>
</td>
<td>
<input type="button" name="action" value="ajouter exercice" onclick="alterExercise([onshow.x_sessionType],2)"/>
</td>';else '']

Related

Replace .Page.UniqueID in hugo to resolve deprecation warning

I'm using the blogdown theme:
https://github.com/shawnohare/hugo-tufte
I've fixed most of the build warnings I get, but I'm having trouble resolving this one:
Page.UniqueID is deprecated and will be removed in a future release. Use .File.UniqueID
I've tracked down the instance of Page.UniqueID to a couple of files which are used to create margin notes via a shortcode.
{{ $marginnoteDomIdSuffix := .Ordinal }}<label for="marginnote-{{ .Page.UniqueID}}-{{ $marginnoteDomIdSuffix }}" class="margin-toggle">⊕</label>
<input type="checkbox" id="marginnote-{{ .Page.UniqueID}}-{{ $marginnoteDomIdSuffix }}" class="margin-toggle"/>
<span class="marginnote">{{ .Inner }}</span>
I've tried a number of replacements of the .File.UniqueID type (.File.UniqueID, .UniqueID, ..File.UniqueId, you get the idea) as suggested in the warning, but have not had much success.

I want to build Xpath for following tab

I want to buid Xpath for depart date drop down date field
https://www.southwest.com/air/booking/index.html?int=HOME-BOOKING-WIDGET-ADVANCED-AIR
I have tried so many combinations but its not working.
example -
//input[#id='departureDate']/span[#class='swa-icon--icon']
//span[#class='swa-icon--icon']
<div class="flyout-trigger date-input"><div class="input input_icon input_left input_secondary"><input type="text" aria-label="Depart Date in mm/dd/yyyy format, valid dates from Jun 12 2019 to Jan 5 2020. To use a date picker press the down arrow." aria-owns="calendar-14" autocapitalize="none" autocomplete="off" autocorrect="off" id="departureDate" spellcheck="false" aria-required="true" class="input--text"><div class="input--icon-separator"><span class="swa-icon input--icon swa-icon_calendar" icon="swa-icon_calendar" size="18" role="presentation" style="font-size: 18px;"><span role="presentation" class="swa-icon--icon"></span></span></div></div></div>
\
The easiest way is sticking to the value of aria-label attribute, you can utilize XPath contains() function in order to locate element basing on the partial text of the aforementioned aria-label atrribute, something like:
//input[contains(#aria-label,'Depart Date')]
Demo:
More information:
XPath Syntax
XPath Operators & Functions
Here is the xpath that you are looking for.
//span[normalize-space(.)='Return date']/following-sibling::div//span[#class='swa-icon--icon']

Organization Chart not escapaing variable - Angular 7

Using PrimeNG advanced Organization Chart: https://www.primefaces.org/primeng/#/organizationchart
Stats:
Angular 7
Chrome Browser: current version
Error:
compiler.js:2430 Uncaught Error: Template parse errors:
Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.) ("
</ng-template>
</p-organizationChart>
</div>[ERROR ->]"): ng:///AppModule/OrdertreeComponent.html#16:6
Unexpected closing tag "ng-template". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags ("
<div>{{node.data.name}}</div>
</div>
[ERROR ->]</ng-template>
<ng-template let-node pTemplate="department">
{ { node.label } }
"): ng:///AppModule/OrdertreeComponent.html#11:4
Invalid ICU message. Missing '}'. ("
</ng-template>
Html:
<p>Organization with advanced customization.</p>
<p-organizationChart [value]="data1" selectionMode="single" [(selection)]="selectedNode" (onNodeSelect)="onNodeSelect($event)" styleClass="company">
<ng-template let-node pTemplate="person">
<div class="node-header ui-corner-top">{{node.label}}/div>
<div class="node-content">
<img src="assets/showcase/images/demo/organization/{node.data.avatar}" width="32">
<div>{{node.data.name}}</div>
</div>
</ng-template>
<ng-template let-node pTemplate="department">
{ { node.label } }
</ng-template>
</p-organizationChart>
Attempted fixes:
I tried to use different types of escape methods for the brackets and really nothing seemed to work. I couldn't find anything that changed with Angular 7.
Changing single curly braces to double curly braces solved this issue for me.

I cannot get ng-class working when the class I am adding has a hyphen in it .

I am trying to add a class to my element in Angular. Here's my code:
<button class="medium"
data-ng-disabled="!gridForm.$pristine || fetching.length != 0"
data-ng-click="getQuestions()">
Retrieve<span class="fa fa-spinner fa-fw mlr75" data-ng-class="{fa-spin: fetching.length > 0}"> </span>
</button>
However it's giving me a strange error:
Syntax Error
error in component $parse
Syntax Error: Token '-' is at column {2} of the expression [{3}] starting at [{4}].
Does anyone have any ideas as to what might be wrong? Note that it works when I use the class faspin without the hyphen !!
Surround class name with singe quotation.
data-ng-class="{'fa-spin': fetching.length > 0}"
Otherwise angular search your scope for fa-spin which is not a valid name for variables.

postLink generates invalid code at CakePHP 2.3

I am using CakePHP 2.3
I have two environments where I have my web application. At the testing environment with the exact same version of the application (all files are the same) I am having a problem with the Form->postLink method.
It shows this error on the Javascript console:
Uncaught TypeError: Object # has no method 'submit' users:119
onclick
Comparing the resulting HTML from both environments I can notice that the attributes name and id generated by this method are repeated more than once in the same page (which shouldn't be like that).
This is the code use to generate those post links:
foreach($users as $user){
$delete = $this->Form->postLink(__('Delete'), array('action' => 'delete', $user['user_id']), __('Are you sure you want to delete %s?', $user['user_id']));
}
This is the problematic generated HTML with repeated values for id and name as you can see:
<!-- link 1 -->
<form action="delete/1/" name="post_51e8019d095f1" id="post_51e8019d095f1" style="display:none;" method="post">
<input type="hidden" name="_method" value="POST"/>
</form>
Delete
<!-- link 2 -->
<form action="delete/2/" name="post_51e8019d095f1" id="post_51e8019d095f1" style="display:none;" method="post">
<input type="hidden" name="_method" value="POST"/>
</form>
Delete
Why is this happening?
Could it be related with the configuration of the web server somehow? I don't see another explanation for it...
Thanks.
The problem was caused by a bug in IIS 7.0.6000.16386 and the PHP function uniqid as pointed out here.
I am using a slightly different version in both environments ( IIS 7.0.6000.16386 vs IIS 7.5.7600.16385) and that was the cause of the problem.
In order to solve it I modified the file lib/Cake/View/Helper/FormHelper.php chaning the line $formName = uniqid('post_'); inside the postLink function to:
$formName = uniqid('post_', true);
That adds more entropy and as the documentation says:
If set to TRUE, uniqid() will add additional entropy (using the combined linear congruential generator) at the end of the return value, which increases the likelihood that the result will be unique.
Update
Ended up having to add one more change due to problems with javascript in forms.
I added one more line after $formName = uniqid('post_', true); so it looks like:
$formName = uniqid('post_', true);
$formName = str_replace('.', '', $formName);

Resources