change from input tag to button
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I want to do some things inside a createCompany() function and if something is true, then only go ahead with the form submission. So I have tried changing it to a button tag linke this:
and after uncommenting the createCompany() function, I can see the form is submitted but I do see an error in console "Uncaught TypeError: this.form is undefined"
Am i doing anything wrong above?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
The likely quickest path to find the input element you want to change is to assign an id and use document.getElementById.
You also probably don't want to do this in a click handler, but rather in a handler for the form's submit event.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Bear Bibeault wrote:What are you expecting this to be evaluating to? (Hint: probably not what you think.)
The likely quickest path to find the input element you want to change is to assign an id and use document.getElementById.
You also probably don't want to do this in a click handler, but rather in a handler for the form's submit event.
Could you maybe explain by providing a code example? Thanks!
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Tim Holloway wrote:This is not just a JSP thing, but the best way to validate data client-side before submitting isn't to use onclick(), it's to use onsubmit(). The code that onsubmit executes returns true or false depending on whether you want the submit to proceed or be aborted.
I believe you are referring to using onsubmit() like this ?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Experience keeps a dear School, but Fools will learn in no other.
---
Benjamin Franklin - Postal official and Weather observer
| Never trust an airline that limits their passengers to one carry on iguana. Put this tiny ad in your shoe: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |










