Passing a JavaScript variable to the view through a HTML form

Requiem

I'm having an issue passing a JavaScript variable through a form correctly to a controller. I'm not sure how to do this since it's my first time working with JavaScript. Any help would be appreciated.

My code can be found below:

  <script>

   function findDoc(e){
      ...
      var ID = grid._data[rIndex].document_ID;
   }

   ...

   {title: Grab, template: "<form action = '<?php echo $exepath;?> docs/grab' method = 'POST'><input type = 'submit' value = 'ID'></form>", width: 90}

   </script>
Alex W

If you are attempting to concatenate the value of the ID JavaScript variable with the string in your code you will have to use JavaScript's string concatenation operator:

{title: Grab, template: "<form action = '<?php echo $exepath;?> docs/grab' method = 'POST'><input type = 'submit' value = '"+ID+"'></form>", width: 90}

Also, I don't think you want a space in your action URL between the PHP echo and docs/grab

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Passing a variable to javascript through HTML Element

From Dev

Passing a variable to a function through a button (HTML/Javascript)

From Dev

Passing variable to form action javascript and HTML

From Dev

Need helping passing javascript variable through hidden form input

From Dev

Passing a variable through the form action

From Dev

Passing HTML through JavaScript

From Dev

Passing Javascript Variable in Form

From Javascript

Passing Variable through JavaScript from one html page to another page

From Dev

Passing an object variable through html

From Dev

Passing the JavaScript variable into HTML

From Dev

Passing a javascript variable in a JSP form

From Dev

Passing javascript/Jquery array to php through a form

From Dev

Passing a variable value through a html button

From Dev

HTML Form to JavaScript variable

From Dev

variable is not passing from javascript to php through ajax

From Dev

Passing HTML form variable to python function in Django

From Dev

how to fix passing variable from view to html

From Dev

Passing custom params through from view to a form_with

From Dev

Passing Javascript Variable Into Template Toolkit Without Form

From Dev

passing Javascript variable to PHP on form submission

From Dev

A href through $ variable javascript/html

From Dev

Passing data from an html form into a Javascript object

From Dev

Passing javascript valiables from HTML form to PayPal

From Dev

Passing a Varible through a form

From Dev

cannot seem to pass variable through JavaScript form

From Dev

HTML Input Form to a Javascript Variable

From Dev

Error while passing Variable from View to Form in Django

From Dev

Passing variable to javascript from html with spaces

From Dev

Passing a JavaScript variable to a html <select> attribute

Related Related

  1. 1

    Passing a variable to javascript through HTML Element

  2. 2

    Passing a variable to a function through a button (HTML/Javascript)

  3. 3

    Passing variable to form action javascript and HTML

  4. 4

    Need helping passing javascript variable through hidden form input

  5. 5

    Passing a variable through the form action

  6. 6

    Passing HTML through JavaScript

  7. 7

    Passing Javascript Variable in Form

  8. 8

    Passing Variable through JavaScript from one html page to another page

  9. 9

    Passing an object variable through html

  10. 10

    Passing the JavaScript variable into HTML

  11. 11

    Passing a javascript variable in a JSP form

  12. 12

    Passing javascript/Jquery array to php through a form

  13. 13

    Passing a variable value through a html button

  14. 14

    HTML Form to JavaScript variable

  15. 15

    variable is not passing from javascript to php through ajax

  16. 16

    Passing HTML form variable to python function in Django

  17. 17

    how to fix passing variable from view to html

  18. 18

    Passing custom params through from view to a form_with

  19. 19

    Passing Javascript Variable Into Template Toolkit Without Form

  20. 20

    passing Javascript variable to PHP on form submission

  21. 21

    A href through $ variable javascript/html

  22. 22

    Passing data from an html form into a Javascript object

  23. 23

    Passing javascript valiables from HTML form to PayPal

  24. 24

    Passing a Varible through a form

  25. 25

    cannot seem to pass variable through JavaScript form

  26. 26

    HTML Input Form to a Javascript Variable

  27. 27

    Error while passing Variable from View to Form in Django

  28. 28

    Passing variable to javascript from html with spaces

  29. 29

    Passing a JavaScript variable to a html <select> attribute

HotTag

Archive