Skip to content

Commit c758b2d

Browse files
committed
more edits
1 parent f999612 commit c758b2d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/v2/cookbook/form-validation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Given a form of three fields, make two required. Let's look at the HTML first:
2727

2828
<p>
2929
<label for="age">Age<label>
30-
<input type="number" name="age" id="age" v-model="age">
30+
<input type="number" name="age" id="age" v-model="age" min="0">
3131
</p>
3232

3333
<p>
@@ -171,7 +171,7 @@ For the third example, we've built something you've probably seen in survey apps
171171
<p>
172172
Given a budget of 100 dollars, indicate how much
173173
you would spend on the following features for the
174-
next generation Star Destroyer:
174+
next generation Star Destroyer. Your total must sum up to 100.
175175
</p>
176176

177177
<p>
@@ -308,7 +308,7 @@ const app = new Vue({
308308
})
309309
```
310310

311-
We start off with a variable representing the URL of the API that is running on OpenWhisk. Now look at `checkForm`. In this version, we always prevent the form from submitting (which, by the way, could be done in the HTML with Vue as well). You can see a basic check on this.name being empty, and then we hit the API. If it's bad, we add an error as before. If it's good, right now we do nothing (just an alert), but you could navigate the user to a new page with the product name in the URL, or do other actions as well. You can run this demo below:
311+
We start off with a variable representing the URL of the API that is running on OpenWhisk. Now look at `checkForm`. In this version, we always prevent the form from submitting (which, by the way, could be done in the HTML with Vue as well). You can see a basic check on `this.name` being empty, and then we hit the API. If it's bad, we add an error as before. If it's good, right now we do nothing (just an alert), but you could navigate the user to a new page with the product name in the URL, or do other actions as well. You can run this demo below:
312312

313313
<p data-height="265" data-theme-id="0" data-slug-hash="BmgzeM" data-default-tab="js,result" data-user="cfjedimaster" data-embed-version="2" data-pen-title="form validation 4" class="codepen">See the Pen <a href="https://codepen.io/cfjedimaster/pen/BmgzeM/">form validation 4</a> by Raymond Camden (<a href="https://codepen.io/cfjedimaster">@cfjedimaster</a>) on <a href="https://codepen.io">CodePen</a>.</p>
314314
<script async src="https://production-assets.codepen.io/assets/embed/ei.js"></script>

0 commit comments

Comments
 (0)