Form POST method to another site - working hack

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
7/19/2012 10:21:40 AM
Gravatar
Total Posts 83
-- Joe

Form POST method to another site - working hack

I was interested in getting some feedback on if this approach to hijacking the POST method in the HTML content feature:

The Need: use a Form POST to another listmanager company site to subscribe/unsubscribe users to an email list

The Hack: in the HTML content feature, going into the Source we start off with the tag </FORM> Then the real form info to POST:

</form>

<form action="http://anotherlistmanager.companyName.com/subfolder/subscribe.tml" method="POST">
<table border="0" cellpadding="3" cellspacing="0">
  <tbody>
   <tr>
    <td align="right">
     Email address:</td>
    <td>
     <input name="email" size="30" type="text" value="" /></td>
    <td>
     &nbsp;</td>
   </tr>
   <tr>
    <td align="center" colspan="2">
     <input align="left" alt="subscribe" class="art-button" name="subscribe" title="subscribe" type="submit" value="Join the Email List" /></td>
   </tr>
  </tbody>
</table>
<input name="list" type="hidden" value="emaillistName" />  <input name="url" type="hidden" value="http://www.mySite.org/subscription-confirmation.aspx" /></form>

This works great - but we have to remember to enter in the </FORM> at the start as the editor strips it out when it reloads.

We havent found any issues with this approach yet.

But does anyone have any thoughts on if this should not be done in this manner and why not?

Thanks in advance for any feedback!

-- Joe Vago

 

7/19/2012 10:28:59 AM
Gravatar
Total Posts 18439

Re: Form POST method to another site - working hack

That hack will break any other form submission or postback of other features on the same page because it closes the main form prematurely and it is invalid markup because there still remains the real closing tag of the main form.

A better way is to implement a custom feature and set the PostBackUrl property on the button as described in the article Building a Simple PayPal Buy Now feature.

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.