Skip to content

Commit

Permalink
Fix code samples [deploy-site]
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Feb 18, 2025
1 parent f500e93 commit de567de
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
7 changes: 3 additions & 4 deletions site/routes_errors_runtime.templ
Original file line number Diff line number Diff line change
Expand Up @@ -436,11 +436,10 @@ templ computedError() {
templ customValidityError() {
<p>The <code>data-intersects</code> attribute must <em>only</em> have a value, representing an expression that must evaluate to a string that will be set as the custom validity message. If the string is empty, the input is considered valid. If the string is non-empty, the input is considered invalid and the string is used as the reported message.</p>
@sampleCode("Example", "html", `<form>
<input data-custom-validity="$foo === $bar ? '' : 'Field values must be the same.'"
data-bind-foo
name="foo"
<input data-bind-foo name="foo" />
<input data-bind-bar name="bar"
data-custom-validity="$foo === $bar ? '' : 'Field values must be the same.'"
/>
<input data-bind-bar name="bar" />
<button>
Submit form
</button>
Expand Down
10 changes: 5 additions & 5 deletions site/static/md/guide/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,21 +347,21 @@ With our backend in place, we can now use the `data-on-click` attribute to trigg
```html
<div
data-signals="{response: '', answer: ''}"
data-computed-correct="$response.toLowerCase() == answer"
data-computed-correct="$response.toLowerCase() == $answer"
>
<div id="question"></div>
<button data-on-click="@get('/actions/quiz')">Fetch a question</button>
<button
data-show="answer != ''"
data-show="$answer != ''"
data-on-click="$response = prompt('Answer:') ?? ''"
>
BUZZ
</button>
<div data-show="$response != ''">
You answered “<span data-text="$response"></span>”.
<span data-show="correct">That is correct ✅</span>
<span data-show="!correct">
The correct answer is “<span data-text="answer"></span>” 🤷
<span data-show="$correct">That is correct ✅</span>
<span data-show="!$correct">
The correct answer is “<span data-text="$answer"></span>” 🤷
</span>
</div>
</div>
Expand Down
8 changes: 3 additions & 5 deletions site/static/md/reference/attribute_plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,10 @@ Allows you to add custom validity to an element using an expression. The express

```html
<form>
<input
data-bind-foo
data-custom-validity="$foo === $bar ? '' : 'Field values must be the same.'"
name="foo"
<input data-bind-foo name="foo" />
<input data-bind-bar name="bar"
data-custom-validity="$foo === $bar ? '' : 'Field values must be the same.'"
/>
<input data-bind-bar name="bar" />
<button>Submit form</button>
</form>
```
Expand Down

0 comments on commit de567de

Please sign in to comment.