Reputation: 2156
I have the following code in my rjs template which displays a confirm box:
page << "r = confirm('Would you like to link this newly created author to the book?')"
I tried
`page << "if r == true {"`
#do action a
`page << "} else {"`
#do action b
`page << "}"`
The code above is incorrect.
My question is how do I get the value of the selection (true or false) made in the confirm box?
Many thanks in advance.
Upvotes: 1
Views: 137
Reputation: 191
Try with this syntax :
page << "var r = confirm('Would you like to link this newly created author to the book?');"
page << "if (r == true) {"
#do action a
page << "} else {"
#do action b
page << "}"
I tried and it seems to work.
Upvotes: 1