Sublime text snippet error - 'No content for snippet' [duplicate] - sublimetext2

This question already has an answer here:
Sublime snippet for ajax not working
(1 answer)
Closed 6 years ago.
I have problem with some of my snippet. I have this error:
No content fort snippet
Packages/User/boot_champs/autocomplete.sublime-snippet
There is the snippet:
<snippet>
<content><![CDATA[
<div class="form-group">
<label>Client : </label>
<div class="input-group" id="">
<input type="hidden" name="DATA[XXXXX]" id="XXXXX" value="<?php echo $XXXXX->XXXXX;?>" >
<input type="text" class="form-control" name="XXXXX" id="XXXXX" value="<?php echo $XXXXX->XXXXX; ?>" placeholder="Taper des caractéres ou flêche du bas">
<span class="input-group-addon" onClick="javascript:$('#XXXX_id').val('0');$('#XXXXX_libelle').val('');$('#XXXX_libelle').focus();" >
<i class="fa fa-times-circle" data-toggle="popover" title="Effacer la sélection" data-content="Cliquer sur la croix pour supprimer la donnée" data-placement="top"></i>
</span>
</div>
</div>
]]></content>
<tabTrigger>boot_champs_autocomplete</tabTrigger>
<scope>text.html.basic</scope>
<description>[Boot] Champs autocomplete</description>
</snippet>

The $ character is a special character used in snippets to add fields or variables. So, you need to escape all your $ characters in your snippet with the \ key.
You can read it in Sublime Text docs:
If you want to get a literal $, you have to escape it like this: \$.

Related

How to insert microsecond symbol in jQuery? [duplicate]

This question already has an answer here:
Jquery inserting unicode instead of symbol
(1 answer)
Closed 2 years ago.
I have tried solution below but not solve.
<div class="form-group row">
<div class="col-lg-4">
<label class="form-control-label">Link Latency:</label>
</div>
<div class="col-lg-8">
<input id="viewLink_linkLatency" class="form-control" type="text" style="width:100%;" disabled>
</div>
</div>
$("#viewLink_linkLatency").val(response.link[0].link_run_link_latency + ' µs');
What is happen now is:
You can use Unicode \u00B5 for jQuery or JavaScript.
UNICODE = U+000B5
HEX CODE = µ
HTML CODE = µ
HTML ENTITY = µ
CSS CODE = \00B5
Source:
https://www.toptal.com/designers/htmlarrows/punctuation/micro-sign/
$("#viewLink_linkLatency").val('Lorem ispsom' + ' \u00B5s');
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input id="viewLink_linkLatency" class="form-control" type="text" style="width:100%;" disabled>
You can just use the literal μ:
$("#viewLink_linkLatency").val('something' + ' μs');
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script>
<input id="viewLink_linkLatency"
class="form-control"
type="text"
style="width:100%;"
disabled />

Button to submit form data to another URL containing #

This is my HTML:
<form action="http://example.com/rezervari/index.html#/hotelbooking" method="get">
<input type="hidden" name="hotel" value="<?= $hotel ?>" class="form-control">
<input type="hidden" name="roomtypegroups" value="<?= $roomtypegroups ?>" class="form-control">
<div class="form-row">
<div class="col">
<div class="form-group">
<label>Sosire</label>
<div class="input-group mb-3">
<input id="from" type="text" name="from" value="<?= $arrival == 'CURRENT' ? date('Y-m-d') : $arrival ?>" class="form-control datepicker1">
<div class="input-group-append datepicker1-h">
<span class="input-group-text" id="basic-addon2"><i class="fa fa-calendar-check-o" aria-hidden="true"></i></span>
</div>
</div>
</div>
</div>
<div class="col">
<div class="form-group">
<label>Plecare</label>
<div class="input-group mb-3">
<input id="to" type="text" name="to" value="<?= $arrival == 'CURRENT' ? date('Y-m-d', strtotime(date('Y-m-d') . ' ' . $departure . ' day')) : date('Y-m-d', strtotime($arrival . ' ' . $departure . ' day')) ?>" class="form-control datepicker2">
<div class="input-group-append datepicker2-h">
<span class="input-group-text" id="basic-addon2"><i class="fa fa-calendar-times-o" aria-hidden="true"></i></span>
</div>
</div>
</div>
</div>
</div>
When I submit the form, the URL loses the "#" and messes it up, and that's no good because the query doesn't work on the secondary website, as it becomes:
http://example.com/rezervari/index.html?hotel=14315&roomtypegroups=44332&from=2020-11-23&to=2020-11-24&roomscount=1&adult=1#/hotelbooking
Instead, it should be:
http://example.com/rezervari/index.html#/hotelbooking?hotel=14315&roomtypegroups=44332&from=2020-09-91&to=2020-09-14&adult=1&numchild1=1&numchild2=1&numchild3=1
How can I pass on the link without the "#" getting removed and the whole URL messed up? Thanks!
Fragment IDs are supposed to link to a specific part of a webpage and are resolved client-side.
Consequently they must go after the query string.
When you submit a GET method form, it will replace everything after the start of the query string in the action with the newly generated query string.
If you have some kind of hack which reads the fragment ID client-side, and you need to put the query string inside the fragment ID so that that code can read it, you can't use the standard form submission logic.
You'll need to add a submit event handler to the form with JavaScript, prevent the default action, build the URL yourself and then navigate to it (e.g. by assigning it to location).

how i can save inputs from html page to text file [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
i have a simple form and i wanna save inputs as a text file how i can do it ?
this is html code
<div id="wrapper">
<div class="main-content">
<div class="header">
</div>
<div class="l-part">
<input type="text" placeholder="Username" class="input-1" />
<div class="overlap-text">
<input type="password" placeholder="Password" class="input-2" />
Forgot?
</div>
<input type="button" value="Log in" class="btn" />
</div>
</div>
<div class="sub-content">
<div class="s-part">
Don't have an account?Sign up
</div>
</div>
</div>
With just html you can only display things on your site. To save things into say a database or in your case a text file, you have to use something like PHP or JavaScript.
Also, the code you have right now doesn't contain any tag. You need this tag to tell the browser that this is a form and can be submitted to your website. Here is a simple example of a form that saves itself to a text file with PHP after submitting:
<?php
if ($_SERVER['REQUEST_METHOD'] === "POST") { // If someone is submitting a form
$myfile = fopen("file.txt", "w") or die("Unable to open file!"); // Open/create the file to write in
// Add parameters that are included in $_POST
$txt = "First Name: " . $_POST["firstname"];
$txt .= "\nLast Name: " . $_POST["lastname"];
$txt .= "\nAge: " . $_POST["age"];
fwrite($myfile, $txt); // Write $txt to file
fclose($myfile); // Save the file
}
?>
<body>
<form method="post">
<input type="text" name="firstname">
<input type="text" name="lastname">
<input type="text" name="age">
<input type="submit">
</form>
</body>
You can´t do this with only HTML.
Maybe this can help you:
Is it possible to write data to file using only JavaScript?
You will need read the input data and save to a .txt file using javascript.

Should the label wrap my input or the other way around? [duplicate]

This question already has answers here:
Should I put input elements inside a label element?
(14 answers)
Closed 4 years ago.
I have this markup:
<form name="access-form" method="post" id="grant-access-page-form">
<label for="randomized-user-radio">
<input id="randomized-user-radio" type="radio" name="access-account-type" value="random">
<div class="access-form--randomized-user access-form-radio-content">
<img class="access-form-radio-content--image" src="">
<h3 class="access-form-radio-content--title"><?php esc_html_e( 'Randomized User', 'sprout' ); ?></h3>
<p class="access-form-radio-content--info"><?php esc_html_e( 'Create a random username that the developers can only use once per session.', 'sprout' ); ?></p>
<ul class="access-form-radio-content--features">
<li class="individual-feature">
<p><?php esc_html_e( 'Need to re-create the account.', 'sprout' ); ?></p>
</li>
<li class="individual-feature">
<p><?php esc_html_e( 'Best security, but slower responses.', 'sprout' ); ?></p>
</li>
<li class="individual-feature">
<p><?php esc_html_e( 'Automatically deletes the account, strong security.', 'sprout' ); ?></p>
</li>
</ul>
</div>
</input>
</label>
<input type="submit" value="<?php esc_html_e( 'Create Developer Account', 'sprout' ); ?>"></input>
</form>
And was wondering if it's correct to have the label wrap my input or it should be the other way around. Way I see it, the input should have a label inside of this, but using the W3 validator, this shows no errors whatsoever.
The way I normally set up my forms is using a definition list
<dl>
<dt><label for="name">Name</label></dt>
<dd><input type="text" name="name" id="name" placeholder="John Doe" /></dd>
</dl>
Labels and inputs are grouped using the for & id attributes.
PS: try and make use of htmlentities();

validation in angular 2

I'm making a litte todo app with angular.
in my component.html i want a validation. If you enter nothing in the textbox then i text is show with "title is required". And when you have less then 5 characters in the textbox then also a text is showing.
But that doesn't work ..
When i start my app i see only my textbox without my todo's. When i enter 1 letter in the textbox then i see my todos. Also when i have only 4 characters i see no notification that says i must have 5 characters ..
This is my code :
<h3>Add todo</h3>
<form >
<input class="form-control" type="text" id="text" required minlength="5" [(ngModel)]="text" name="text" >
<div *ngIf="text.errors && (text.dirty || text.touched)" class="alert alert-danger">
<div [hidden]="!text.errors.required">
Title is required
</div>
<div [hidden]="!text.errors.minlength">
titel moet minstens 5 karakters zijn
</div>
</div>
</form>
<button class="btn btn-danger" (click)="addTodo()">test</button>
You need to use the template reference with ngModel to bind the error messages. Like so: #text="ngModel".
The two-way-binding won't work with the same name, so they have to be different. Here I have actually changed the name of the two-way-binding variable to theText:
<input type="text" id="text" required minlength="5" [(ngModel)]="theText"
name="text" #text="ngModel">
Here's the complete template, notice we are giving the form a template reference #myForm="ngForm" and on submit we pass the values from that form:
<form #myForm="ngForm" (ngSubmit)="submitForm(myForm.value)">
<input type="text" id="text" required minlength="5" [(ngModel)]="theText" name="text" #text="ngModel" >
<div *ngIf="text.errors && (text.touched || text.dirty)" class="alert alert-danger">
<div [hidden]="!text.errors?.required">
Title is required
</div>
<div [hidden]="!text.errors?.minlength">
titel moet minstens 5 karakters zijn
</div>
</div>
</form>
As a sidenote, you maybe even don't need the two-way-binding (??) here? You could extract the data from the object you get of the form values (myForm.value).