• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

window.confirm box

 
Ranch Hand
Posts: 126
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a problem with my program.  Whenever I enter a value in my window.confirm (from my function: quantity, price, or item) it come up as undefined. Any suggestions?



 
Marshal
Posts: 67447
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "answer" to window.confirm() is returned as the value of the function call. You're not doing anything with it.

Btw, I'd suggest putting the script into a single block rather than one at the beginning and one at the end.
 
Daniel Martos
Ranch Hand
Posts: 126
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The "answer" to window.confirm() is returned as the value of the function call. You're not doing anything with it.

Btw, I'd suggest putting the script into a single block rather than one at the beginning and one at the end.



I'ved changed it to this, but I think that I'm supposed to create a new function here, but how do I call my placeOrder() function to be used here?

 
Marshal
Posts: 3180
466
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like you have a bracket problem in your function.

Your browser's developer tools would have highlighted this.
 
Daniel Martos
Ranch Hand
Posts: 126
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:It looks like you have a bracket problem in your function.

Your browser's developer tools would have highlighted this.



Yes it does appear that I do, but that being said.  placeOrder() is a function that I used to store arrays.  I need to create a window.confirm box that calls that function.
 
Daniel Martos
Ranch Hand
Posts: 126
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:It looks like you have a bracket problem in your function.

Your browser's developer tools would have highlighted this.



W3 School says to do this:



But I need to call my placeOrder() function so that window.confirm box can have that information....
 
Ron McLeod
Marshal
Posts: 3180
466
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Daniel Martos wrote:placeOrder() is a function that I used to store arrays.  I need to create a window.confirm box that calls that function.


That is different than what you are doing now.  In your example, you are calling confirm from within the placeOrder() function.  Are you thinking something like this?:
 
Daniel Martos
Ranch Hand
Posts: 126
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:

Daniel Martos wrote:placeOrder() is a function that I used to store arrays.  I need to create a window.confirm box that calls that function.


That is different than what you are doing now.  In your example, you are calling confirm from within the placeOrder() function.  Are you thinking something like this?:



I guess let me show you the whole thing.  placeOrder() is a function in the heading.

 
Daniel Martos
Ranch Hand
Posts: 126
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The "answer" to window.confirm() is returned as the value of the function call. You're not doing anything with it.

Btw, I'd suggest putting the script into a single block rather than one at the beginning and one at the end.



Bear,  Can I put my confirm in my original placeOrder function?  How do I do that if I can?

 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic