R2i DotNetNuke® Forum

R2i wants you to have the opportunity to ask questions, post reviews, help others or just rant and rave about DotNetNuke® or any of the R2i Modules and Skins. Our team spends hour upon hour, day after day, working on custom DotNetNuke® modules and services; please feel free to ask us anything.
 
FORM post to another site
Last Post 18 Mar 2009 06:30 AM by gigipayne. 8 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Informative
alewjrUser is Offline
New Member
New Member
Posts:12

--
24 Jul 2007 08:43 PM  
Anyone know how to convert this form to ListX?

<form> method="POST" action="http://www.house.gov/htbin/wrep_findrep">
<input type="hidden" id="state" name="state" value="NCNorth Carolina">
<input type="hidden" id="zipcode" name="zip" value="27502">
<input type="hidden" name="zip4" id="zipext" value="1479">
<input id="lookup" type="submit" value="Contact My Representative" tabindex="4" title="Click the Find my

Respresentative button. Use the ALT + f keys to submit state and ZIP code information." accesskey="f">
</form>

pauldesUser is Offline
Veteran Member
Veteran Member
Posts:1392

--
25 Jul 2007 02:34 PM  
http://dnn.bi4ce.com/Support/Forums/tabid/106/forumid/7/postid/6340/view/topic/Default.aspx
ListX....makes you look brilliant, even though you're not.
alewjrUser is Offline
New Member
New Member
Posts:12

--
26 Jul 2007 07:40 PM  
Thanks for the post. However, this form redirects through the site in the action statement of the form and redirects to the specific representative's website. Therefore, this form goes my site --> US House of Representative page --> Representative personal site. I can't get the INPUT to work properly. It returns the HTML code for the US House of Representative page. I just want to be able to redirect to the personal representative's site.
jarra64User is Offline
New Member
New Member
Posts:30

--
14 Nov 2007 08:52 PM  
I need this same functionality. Does anyone know how to post form data to an external URL and redirect the user to that page? I am not in need of an XML or TEXT response.
mrwebslingerUser is Offline
Basic Member
Basic Member
Posts:357

--
14 Nov 2007 08:59 PM  
Add me to the list. I need to do the same thing as well.
ewalkerUser is Offline
Basic Member
Basic Member
Posts:221

--
15 Nov 2007 03:45 PM  
I would say your best bet is to use javascript to make the post. You can simply build a form obj in the browsers DOM, add your hidden input fields, and then execute the submit. Here is rough outline:

<input type="button" onclick="submitForm({'form': {'method': 'POST','action':'http://localhost/dnn46/dev.aspx'},
'data': {'state': 'NCNorth Carolina', 'zip':'27502', 'zipext':'1479'}
})" value="Contact My Representative" />

<script type="text/javascript">
/* <![CDATA[ */
function submitForm(input)
{
// create dom form object
//var f = getForm('POST', 'http://www.house.gov/htbin/wrep_findrep');
var f = getForm(input.form.method, input.form.action);
// create dom hidden field objects and attach to form
for (var e in input.data)
{
f.appendChild(getHiddenField(e,input.data[e]));
}
// attach form to page dom (after the main form because forms cannot be nested).
document.getElementById("Body").appendChild(f);
// call submit() on the form
f.submit();
}

function getForm(method, action)
{
var f = document.createElement('form');
f.setAttribute('method', method);
f.setAttribute('action', action);
return f;
}
function getHiddenField(key, value)
{
var i = document.createElement('input');
i.setAttribute('type', 'hidden');
i.setAttribute('name', key);
i.setAttribute('value', value);
return i;
}
/* ]]> */
</script>

I cannot promise this will work because the website may require POST requests to be made from the site itself, but for most cases, this meet your needs.
Eric Walker - R2integrated
mrwebslingerUser is Offline
Basic Member
Basic Member
Posts:357

--
15 Nov 2007 04:05 PM  
What I am looking to do is to handle the data with ListX to do things on my end and as well as send the data to a CRM (I keep a redundant copy on my server). They have provided me with the code to do so but I am having a hard time trying to figure out how to do both. I will look at the example above to see if it would work for me.
ewalkerUser is Offline
Basic Member
Basic Member
Posts:221

--
15 Nov 2007 04:42 PM  
You could certainly store the data on your and then use this javascript clientside to make the post to the external server afterwards.
Eric Walker - R2integrated
gigipayneUser is Offline
New Member
New Member
Posts:16

--
18 Mar 2009 06:30 AM  
Great post! I had to integrate a link to Constant Contact that was expecting a post with some hidden fields data. This javascript did the trick.

Thank You!
You are not authorized to post a reply.

Active Forums 4.1
 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seatle, WA • 410.327.0007 • info@R2Integrated.com

Bookmark & Share Bookmark and Share