• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaScript return string

 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,

I am not sure why this isn't working. It populates the text box that I want the JS to return the value to but only for a second. Why isn't the value staying? I am guessing it has something to do with what is happening on submit but I don't know. Any help would be appreciated- more help is appreciated more
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you're trying to accomplish-that form (containing the value being set) isn't being submitted, so any value in that form will be lost. The first form *is* being submitted, causing a new request.
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried putting them all in one form and I've tried setting the output several different ways but it want keep the value. I don't understand what I am doing wrong or how to make it right.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "keep the value"? After the form is submitted its values are gone unless you preload them somehow with values from the server.
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK-what I am trying to do is have a function that takes 2 values and populates a third field on the page based on the values passed in using javascript. How can this be done?
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured it out. Instead of using onSubmit in the form I did this.


Thanks for the help-I appreciate it.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic