Drupal webform form action - drupal

I'm adding a form to a Drupal website. I've created a new page, and created a webform, the webform has been assigned to the page content as a block.
The problem I'm having is when submitting the form, instead of showing the errors of the form at the top of the page like the rest of the forms do, the form action is set to the individual web form page, and any styling/content blocks disappear.
Essentially what I need to do is ensure the form posts to the same page, if I edit the form action in dev tools, the errors show fine at the top of the page.
EDIT: Should also add - I've setup the page and wbeform as per all the others, and they all function as they should and post to the same URL as the page.
Any help appreciated.
Thanks

If you are using the Webform module then you can go to the configuration page of the block in the 'Blocks' section, and look for the following checkbox:
Show all webform pages in block
The description under the checkbox tells you that anything that has to do with the webform (includes errors) will be shown on the current page, instead of redirecting you to the original webform page:
By default multi-page webforms redirect to the node page for all pages after the first one. If checked, all pages will be shown in the block instead.

Related

Not able to add form tag inside Content Page

I have a Master Page and a Content Page. I have Check In Check Out small form in Master Page and I have a Contact form in Content page. But while running the website, I am getting the error which says:A page can have only one server side form tag. When I remove the form tag from the Content Page. Then,it says the Textbox should be placed within a form tag. But I want both the forms,since both are necessary. So please help me so that I can have both the forms.
There can be only one <form> tag on the whole page, that is just how webforms work. In your case it is in the master page. The pages using the Master do not and should not have <form> tags.
But from your question it seems that you think you are using master pages, but are actually not. See this page as to how the .aspx pages are supposed to look with master and child pages.
https://learn.microsoft.com/en-us/aspnet/web-forms/overview/older-versions-getting-started/master-pages/creating-a-site-wide-layout-using-master-pages-cs
It is not possible to add more than one form in a single aspx file. Otherwise try to use iframe in that page.Inside the iframe we can use another aspx page.

Master page oddity on server deployment

I have inherited a solution created in ASP.net with VB.net and am having a real problem with the error message "Content controls have to be top-level controls in a content page or a nested master page that references a master page."
The design is somewhat complex as follows:
The app uses a single Masterpage. The child page accessed has a custom user control on it. The user control contains, amongst other controls, an iframe. The source of the iframe is set programatically to another page, (aspx) which does not inherit from the Masterpage as we don't want the headers, footers etc. to appear in the iframe.
This aspx page has another custom user control on it that displays a small number of controls, buttons, text fields, file upload etc.)
This all works well in my IDE (Visual Studio 2005) and the file upload control is displayed properly. As soon as it's deployed to a server, (test or live) I get the error message at the beginning of this post.
The pages and code are too complex to post here but if I haven't given enough detail I will try to explain as necessary. I hope someone can help as this has been driving me insane. I've searched extensively with no success.
Many thanks.

drupal Webform Issue

I have created a tpl file for render the webform node.webform is working fine but after submit it returns to same page rather than goto thanks page. i want to redirect the action to thanks page.
You can actually create your own page that you want your users to be directed to after submitting a webform, and provide whatever links you like on this page. To do this, edit the webform and go to Form Settings. Under Submission Settings, click Customize Confirmation and choose "Redirect to a different page" from the jump menu. Under path, provide the path to this page that you've created.

Stop Master page refreshing while navigating between pages?

I'm using Master Page in my ASP.net application, in the master page I put a ContentPlaceHolder in Update Panel to support AJAX in child pages, the question is how to stop Refreshing "master page controls" while navigating between pages?
For navigation between pages I tried to use Response.Redirect, windows.location java script with no success, shall I use the Frames or IFrames instead of Master Pages to stop Refreshing?
any suggestion to solve this issue will be highly appreciated, Thanks in advance...
If you don't want the page to refresh when switching between "pages", you will not have any good solution using master page. As others have said in different words, the master page is just a common "template" that is used by different pages. The navigation between is just like calling different pages, and of course will reload the entire page, including the master page content.
A sollution I have used with Ajax is
to have each "page" as a user
controls, and put them all in an
UpdatePanel with visible="false".
Then for navigation between "pages", switch
visibility for the user controls
to show the right "page" control.
The alternative is to use iframe.
Neither of these solutions use MasterPage.
The MasterPage concept was designed to simplify a common look before Ajax was introduced in ASP.NET. After Ajax became popular, the demand for not refreshing the entire page has been more common.
A masterpage is nothing more than extending your "normal" page with (most of the time) the default layout of your application. The master page and the contentplaceholders are rendered as a full html page. When you navigate between pages it is the normal behavior that your whole page refreshes. This is how the web works.
Working with an iframe could solve your problem. However that has some other side effects:
The whole masterpage isn't useful anymore. The content around your iframe is the "masterpage".
With a masterpage you actually browse to another url, you also see in the url bar of your browser. When you work with an iframe you navigate within the iframe to another page. The url in your browser will stay the same. When the user of your application hits the refresh button it always starts again at the default page you assigned to your iframe in the html. Of course there are some workarounds
Anyway. It really depends on your application. There are multiple solutions to work around the refresh behavior.
Having a structure like the one you've explained:
Master
Child page 1
Child page 2
...
Then you cannot prevent the page from refreshing when you switch from page 1 to page 2 etc. for you have a single "page" entity (master content + selected page content) when it's rendered to the browser.
If you want to switch betweent different app views inside the very same page (so to prevent a complete page refresh) you could use a single page (the Master becomes quite useless) with an updatePanel in which you load the different views.
You can also use iFrames, but if you have to handle any type of communication between different parts of the page (some of which are inside iFrames) I would personally advice not to use them.

Error appeared when I changed default page in visual studio

First, I did not like the index.cshtml page is that it contains the signature of Web API ASP.net, the API link, ...so on. And it also it contains the footer as '2015 # My Asp.net Application'.
So, is there a way that I can get rid of the header and signature? I found the solution as that could be at the master page, but I couldn't find the master page with extension (.master) in my application.
Please help me in getting rid of the header and signature of Asp.net Web API.
Second, I set another page as 'Set page as Start page' or as default page. Then when I changed my mind and came back and made the index.cshtml page as default page as it was, I got Server Error (page not found).
Please help me in either one way where I can create a new html page to add my code in it, and I can make it as start page without problems.
Or at least, let me fix the error that occurred in the index.cshtml page, where I can come back to it and use it again.
Thank you
In MVC razor the master page is referred to as the _Layout.cshtml page it can be found inside Views->Shared.
To set the default page you would have to set the default action and controller in the routing table
Footer
Ctrl+Shift+F Search Entire Solution for: "My Asp.net Application". This displays _Layout.cshtml as a search result.
Default Page
Go To Project > Properties > Web.
Remove Start Action Specific Page (make it blank).

Resources