Question about plentyoffish.com asp.net functionality - asp.net

One the frontpage of plentyoffish.com, the 'Continue' button (for the form submission) links to register.aspx. From what I can see the system does not use postback. So, my question is, how is the form data posted to register.aspx? What would that code look like?

i'm not sure if we're talking about the same thing here, but the continue seems to be an image type input, which works the same as a submit, and submits the form to register.aspx.

If you look at the html source of the page, you will find the following code
<form method="POST" action="register.aspx" NAME="Register853049" onsubmit="return submitForms(this);">
The action is specified as register.aspx, so when this form is submitted to the server it is submitted to register.aspx

Related

Contact form 7 is posting to a url instead of posting via ajx

I am using contact form 7 plugin here (http://www.brazendev4.com/Cadental/) on right side. When I press Submit button page posts back to a url and refreshes but normally it posts via ajax and page does not refreshes. Any help will be appreciated.
Thanks in advance...
If you're planning on using ajax/js to process the form, you probably should have an empty action attribute in your form element.
e.g.
<form action="" method="post" class="wpcf7-form">
Try using the onclick attribute of the submit element to call your associated javascript function to process and post via ajax to "/Cadental/#wpcf7-f14-w1-o1".
e.g.
<input type="submit" value="Submit" onclick="MyJavascriptFunction(this.form)" class="wpcf7-form-control wpcf7-submit text2">
My guess is that before your javascript has time to process the form the DOM is posting to action="/Cadental/#wpcf7-f14-w1-o1" and reloading the page.
I see you're using jQuery in your page, so it should be easy enough to use their serialize form function to process your form.
http://api.jquery.com/serialize/
Good luck!
Best thing to do is look at the other plugins or even the theme that you are using, making sure that nothing is conflicting with CF7 which is notorious for conflicting with other javascript you use.
Check out the docs they might be able to help.
Otherwise, if the edit ability of the forms isn't important, I'd even suggest building your own form and submitting it via AJAX.
There are plenty of resources and tricks and tips around for doing this.

ploneformgen confirm data before submit

I am creating a multi-stage form with ploneformgen. I would like to add a confirmation page showing all the data that has been entered, before the form is finally submitted. Something similar to a thank-you page, but with a submit button.
/Iz
Look at http://pypi.python.org/pypi/collective.pfgpreview
I haven't done this myself, but I think you can probably adapt the "hidden field" technique at http://plone.org/products/ploneformgen/documentation/how-to/create-a-multi-page-form to accomplish this. Combine with how the "thank-you" template displays the submitted fields.

Cross-Page Posting with a Master Page

I found a workaround for my specific need, but I thought I'd ask this question anyway.
Say I have a typical data entry web project with a master page -- instead of using the Session variable and using Response.Redirect or Server.Transfer to redirect users who are part of the way through data entry to the next step, I'd rather use cross-page posting.
I tried setting up one of my websites in this manner, with a button like:
<asp:Button ID="next" text="next" runat="server" PostBackUrl="EnterInfo.aspx" />
When I went to test the changes, my <form> tag hadn't changed at all:
<form id="aspnetForm" action="SelectUser.aspx" method="post" name="aspnetForm">
Did I miss any details here, or is cross-page posting simply not intended for use with a master page?
Edit:
The form tag above is the tag as rendered on the client -- not the server-side tag. I've read MSDN articles (like this one) that seem to me to explicitly state that cross page posting actually posts the form to another page.
Perhaps I've misinterpreted this as changing the form's action, but regardless my source form does not post invoke anything anywhere on my target when I click the button I altered -- it merely posts back to the current page.
I don't think using the PostBackUrl attribute will change the action of the form in the markup, as there could be many other controls just doing a normal postback. I imagine that some javascript is used to change the action of the form when this particular button is pressed.
You need to place a declaration on the second page where data come from.
So you have:
PostBackUrl="EnterInfo.aspx"
On EnterInfo.aspx you declare where you can get informations
<%# PreviousPageType VirtualPath="~/SelectedUser.aspx" %>
and you get them by...
if (Page.PreviousPage != null)
{
if(Page.PreviousPage.IsCrossPagePostBack == true)
{
GetTheClass = PreviousPage.MyDataClass;
}
}
The PostBackUrl not change the form url.
Some reference.
ASP.NET how to access public properties?
Cross-page postbacks and back again retaining data from source page
Ps
At first I was thinking that you have just type what you see at render, but if not the case As #Mystere point out you need to run this inside an asp.net form.
First, as Graham says.. PostBackUrl does not change the postback action. Second, you can only use PostBackUrl on an asp.net enabled form, which means the form must have runat="server"

Running code/script as a result of a form submission in ASP.NET

An outside vendor did some html work for us, and I'm filling in the actual functionality. I have an issue that I need help with.
He created a simple html page that is opened as a modal pop-up. It contains a form with a few input fields and a submit button. On submitting, an email should be sent using info from the input fields.
I turned his simple html page into a simple aspx page, added runat=server to the form, and added the c# code inside script tags to create and send the email.
It technically works but has a big issue. After the information is submitted and the email is sent, the page (which is supposed to just be a modal pop-up type thing) gets reloaded, but it is now no longer a pop-up. It's reloaded as a standalone page.
So I'm trying to find out if there is a way to get the form to just execute those few lines of c# code on submission without reloading the form. I'm somewhat aware of cgi scripts, but from what I've read, that can be buggy with IIS and all. Plus I'd like to think I could get these few lines of code to run without creating a separate executable.
Any help is greatly appreciated.
If you don't want the page to reload after submission, you will need to use AJAX. that is alot more complicated. you would still need the submit.aspx, you cannot send email with javascript.
Code a redirect after the form submission, so instead of getting the same form back in the main document/page, you could get something like a blank page saying "Thanks for your submission!" or something of that nature.
Might be more simple to redirect the user to a result page using Respone.Redirect that displays some sort of "Your email has been sent" message, or even just redirect back to the base page.

posting file input type to a form

First I must say that my problem happens when I'm trying to post to another form.
I have 3 controls in a form:
1. text input named "text1".
2. file input named "file1".
3. submit input.
the form itself have a post method to another page.
in the page load of the posted page I'm using Request["text1"] which gives me the text of "text1". when I'm Request["file1"] I get nothing.
help?
You need enctype="multipart/form-data" in your opening form tag.
<form method="post" action="somepage.php" enctype="multipart/form-data">
...
</form>
If that doesn't help, 4GuysFromRolla have an article on this very topic:
Uploading in ASP.NET
Request["file1"] is not a string, it's a file, so you can't peek inside it that way. How it is handled will depend on the server-size platform you're using.

Resources