# WebDev Post from page to page example

**URL:** <https://forum.inductiveautomation.com/t/webdev-post-from-page-to-page-example/41584>\
**Category:** Ignition\
**Created:** [December 16, 2020, 8:28pm UTC](https://forum.inductiveautomation.com/t/webdev-post-from-page-to-page-example/41584 "2020-12-16T20:28:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [December 16, 2020, 8:28pm UTC](https://forum.inductiveautomation.com/t/webdev-post-from-page-to-page-example/41584/1 "2020-12-16T20:28:12Z")

</div>

Could someone provide example code that shows how to do a Post from one WebDev page to another WebDev page?  
No matter what combinations I have tried I cannot get it to have the postData accessible.

Basically a form to do a post on the first page, and the second page to get the postData for processing?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 16, 2020, 8:33pm UTC](https://forum.inductiveautomation.com/t/webdev-post-from-page-to-page-example/41584/2 "2020-12-16T20:33:09Z")

</div>

Yes, a form should definitely work if you want a user-submitted POST. Are you able to share any HTML you’ve tried so far?

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [December 16, 2020, 8:39pm UTC](https://forum.inductiveautomation.com/t/webdev-post-from-page-to-page-example/41584/3 "2020-12-16T20:39:44Z")

</div>

```
ht = '<form class="navbar-form navbar-left" action="LinkToWebDevPageToProcessPOST" method="POST">'
ht += '<div class="form-group">'
ht += '<label for="sDate" class="sr-only">Start Date</label>'
ht += '<input name="SDate" type="text" placeholder="Start Date" class="datepicker-here" data-language="en" data-date-format="yyyy-mm-dd">'
ht += '<label for="eDate" class="sr-only">End Date</label>'
ht += '<input type="text" name="eDate" placeholder="End Date" class="datepicker-here" data-language="en" data-date-format="yyyy-mm-dd">'
ht += '<button type="submit" class="btn btn-primary">Submit</button>'
ht += '</div>'
ht += '<input type="hidden" name="Plant" value="237">'
ht += '<input type="hidden" name="Line" value="line1">'
ht += '</form>'    
return {'html': '<html><head></head><body>'+jy+'</body></html>'}

```

Is the most basic attempt I have tried.  
Just a form with a POST action to another page.  
The other page fails with a key error on the postData

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 16, 2020, 9:49pm UTC](https://forum.inductiveautomation.com/t/webdev-post-from-page-to-page-example/41584/4 "2020-12-16T21:49:42Z")

</div>

I have a resource named `post`. `doGet` is defined as:

```python
	html = """
	<html>
	<head>
	</head>
	<body>
		<form class="navbar-form navbar-left" action="post" method="POST">
			<div class="form-group">
			<label for="sDate" class="sr-only">Start Date</label>
			<input name="SDate" type="text" placeholder="Start Date" class="datepicker-here" data-language="en" data-date-format="yyyy-mm-dd">
			
			<label for="eDate" class="sr-only">End Date</label>
			<input type="text" name="eDate" placeholder="End Date" class="datepicker-here" data-language="en" data-date-format="yyyy-mm-dd">
			
			<button type="submit" class="btn btn-primary">Submit</button>
			</div>
			<input type="hidden" name="Plant" value="237">
			<input type="hidden" name="Line" value="line1">
		</form>
	</body>
	</html>
	"""
	return {'html': html}

```

`doPost` is just:

```auto
	log = system.util.getLogger("webdev post")
	log.info(str(request["data"]))
	log.info(str(request["headers"]))
	log.info(str(request["params"]))

```

If I load the page and submit the form, then go into the logs, `request["params"]` is logged as:  
`{'Line': u'line1', 'Plant': u'237', 'SDate': u'asdf', 'eDate': u'asdf'}`  
Maybe your form URL isn’t redirecting properly? Try browser dev tools (the network tab, specifically) to make sure the POST is going to the location you expect it to.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [December 16, 2020, 9:58pm UTC](https://forum.inductiveautomation.com/t/webdev-post-from-page-to-page-example/41584/5 "2020-12-16T21:58:02Z")

</div>

You aren’t using the  
`request['postData']`

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 16, 2020, 10:24pm UTC](https://forum.inductiveautomation.com/t/webdev-post-from-page-to-page-example/41584/6 "2020-12-16T22:24:07Z")

</div>

`request["postData"]` is deprecated since 2015, but is exactly the same data as `request["data"]`.

In either case, `request["params"]` is the actual key you want to access the form data.
