So in her handler, we've created a widget model and we've passed that to our template and we passed
it in the data variable, which is a map of string interface, and we called it widget.
So let's go over to our buy once page and actually use that.
So right here inside the content blog, I'm going to define a variable and I'll call it widget and that
will be assigned the value of index data widget.
So now I have that widget available to me.
So let's start our back, end up make sure it's going make start back.
I don't think I ever run.
There it is, and let's run air.
OK, now let's bring some information out and make sure we actually have that variable, and again,
this dollar sign widget variable is only available in the content block.
So I'll just print it out and I'll put it right above the title just to make sure it's working so well
here.
I'll say a dollar sign widget dot name and that should print out the name if everything worked according
to plan.
So let's make sure we compiled it did.
Now let's go back to our Web browser and I'll simply load this page and go to products and buy one.
And there it is, custom widget.
So I have that variable available to me.
So there's some things I can change in this form right away.
So to start with, I'm going to add a hidden field inside the form tag and I'll call it input type equals
hidden name equals product I.D. and the value will be equal to dollar sign widget ID.
And I don't duplicate that line and put the price there price and this will be product underscore price,
you can call those whatever you want, but that's what I have for right now.
Now, if we scroll down a little bit, you'll see that I have this amount.
So let's comment that because we don't want that at all.
And instead we'll make this actually named amount, because that's what I want to look for in the JavaScript
there.
That's better.
And I always display the price.
So we'll just say each three that we can form at this hour, we want later on dollar sign widget dot
name followed by a colon, and then we'll put the price and it's not going to look right.
But we'll fix that in a little bit.
Widget dot price and close that H3 tech.
Let's see how that looks.
So I'll save that.
Go back to my Web browser, reload this page and I have an error.
Let's see what the error.
There is no Wittert.
There's a widget, though, so let's save that.
Make sure recompile.
There it is.
Let's try that again.
Custom widget.
One thousand.
Now, I'm not going to spend a thousand dollars on this little widget, so we're obviously going to
have to somehow format this as currency so we can do that using our functions that we're going to make
available to our templates.
So we'll do that in a little while.
OK, so let's go back here and just format this a little bit better.
So I'll change the eight three three to class equals and I'll give it a margin at the top of C two and
I'll send it to text center.
OK.
See how that looks reloaded a little bit better.
OK, and maybe give it a of the bottom two, so maybe three and then I'll put an H.R. there and after
the title, I'll put a paragraph in and I'll put in a dollar sign widget description and close that
paragraph tag.
And up here, we'll get rid of displaying the legitimate.
So let's reload this right again, a very nice switch.
OK, so we can format that however we want, one of the things we're going to have to do is to write
a function to format this appropriately.
And that's pretty straightforward.
And we'll do that in the next lecture.
And then, of course, we'll want to actually try to run a transaction.
But this time when we run, the transaction will also create a transaction model to save that information.
And we won't do that until we implement the database functions.
But of course, at the moment when that transaction is complete, we have a lot of information and we're
going to want to save some of that because at some point we might have to do a refund or something like
that.
So we'll get started on that in the next lesson.