Unable to understand a html attribute - html

I am learning html from w3schools. They have used <form action="demo_form.asp"> this form tag with attribute action="demo_form.asp. I know the meaning of form tag as well as action attribute. But I don't know what is the meaning of action="demo_form.asp". When I use this attribute action="demo_form.asp", a file named demo_form.asp start downloading!
Can anybody explain me this thing?
Full code is here.

action attribute define the page to be use to post the data, when you hit submit button it redirect to the page you have mentioned in the action attribute. so that you can access the data submitted through this page.

The action="demo_form.asp" attribute is the file to which your <form> will be submitted.

From HTML spec
action = uri [CT]
This attribute specifies a form processing agent.
It's used to send the request to the page (url) specified in the action attribute when the form is submitted.
As per the example:
Once you enter your favourite color in the input box & click submit.
The form details is sent to the server page (demo_form.jsp) based on form action.
There the form is processed and based on the input, it's redirecting you to different page.
Where you can find the fav color which you have entered is mentioned there.
Input was received as:
favcolor=blue

The value of the action attribute tells the browser the location of the script that will process this form. In the example you have provided, the data submitted by the user in the form will be processed by the file/script called demo_form.asp.

The action element points to a thing that will handle the content of the form you have submitted. This can be as simple as a new page (maybe php), or a .cgi script, and so on. In your case it is attempting to submit to an ASP page. If you are attempting to use the form in your own pages, it is likely your browser can't find 'demo_form.asp'.
Why it is attempting to download it, rather than just tell you the page is missing, I'm afraid I don't know.
Hope this helps.

demo_form.asp should execute and not download. How are you running the file? It looks like your IIS is not enabled.
If you are trying this locally, to run ASP you'll have to configure IIS in your system (it is not enabled by default) and then use
http://localhost
.... to run your file. Otherwise ASP will not execute. See http://msdn.microsoft.com/en-us/library/ms181052(v=vs.80).aspx for enabling IIS. Once IIS is enabled,
http://localhost
will point to c:\inetpub\wwwroot folder by default. Create a folder in wwroot (say test) and place your files inside that folder. If your file is abc.asp then to run it you'll have to type
http://localhost/test/abc.asp
.
Hope this helps.

Related

name attribute of <input> Element of HTML forms be omitted

I know that if an input element of html form does not have name attribute it will not be sent at all but i saw a webpage that gets user informations like password and the input element of its html form does not have name attribute
so do you have any idea that how does such pages sends user password to the server?
There are ways in which the data could be sent from an HTML client.
If you could provide a link to the website in which you saw it, I could may be look and tell.
They probably used "XMLHttpRequest" asynchronous mode to get and send data to the server.
Take a look at this link: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest

Passing info in a URL to Sharepoint

I'm new to SharePoint but I was wondering if there was a way to pass variables from an external website to a SharePoint Web Part via GET.
e.g.
http://mysharepointpage.com/sites?name=Jay&age=23 does not populate my name or age input fields in the SharePoint Web Part.
Note: I had to remove the <form method="GET"> tags because I kept getting an error advising;
<FORM> tags are not supported in the HTML specified in either the Content property or the Content Link property. You can
remove the <FORM> tag, or use the Page Viewer Web Part, which supports the HTML <FORM> tag. The Content property can
be modified in the Rich Text Editor or Source Editor. More about the Page Viewer Web Part
When I click on the link it tells me;
Cannot display help.
Technical details: HC not found.
I'm guessing this is why I can't retrieve the data via URL.
A little more information as to how would be much appreciated.
Your query string looks correct:
Connect a Query String (URL) Filter Web Part to another Web Part
You will then need to implement javascript on the page to loop through all the keys and populate the form as required.
You should be able to use this link to help you with your javascript or please post what you are currently using: Getting query string values in JavaScript

I see an `onprogress` when I inspect a `Form` element. Can I use it?

I see an onprogress when I inspect a Form element, on Chrome and Firefox (both latest stable versions). Can I use it to monitor the progress of the form submission?
I want to submit/upload a file (that will be big most of the time) to a server that is not under my control, I can't just do a POST to it with XMLHttpRequest because it won't send any of the CORS required headers. So I'm going for the form/iframe way, creating a form element with all the fields, add a file input, append to the file input the file instance I got from another dialog, create an iframe and set the target of the form to the name of the iframe.
Is this onprogress attribute something I can use? I can't find any docs regarding the onprogress attribute of a form. Is that just an inherited attribute or does it actually work?

Is the html form "action=" attribute still valid without a specific handler program?

i.e. -
<form action="http://192.168.1.20/form_action.asp" method="get">
vs. (without a specific handler, still valid html?)
<form action="http://192.168.1.20" method="get">
Creating a very basic custom web server on windows (will be c or C#).
Creates a page with one form and input field.
Can I bypass a separate form handler and just pull the value from the web server at some point?
Thanks.
Yes. action need only be a valid URL. The path of that URL (everything after the server name, or in this case, IP) does not matter.
The html is fine. You will want to mod apache (or whatever webserver you are using) to direct the action url/ip to the right place, though.

HTML Forms without actions

In Django / Pinax, I've come across the login form which starts like this :
<form class="login" method="POST" action="">
It works perfectly well. So I assume that either some java-script or something in the Django framework is putting the value into the action attribute.
So, my questions:
How does Django insert the action?
Why do they do it like this?
How can I find out what the action of this form is?
Update : I see this is not a Django thing at all, but what most browsers do.
Having an action of an empty string in most browsers points the form at the URL the browser currently has loaded, which is the script that served the form in the first place.
For an interesting insight on forms with empty actions read this thread, which gives you an updated HTML5-perspective on this matter.
It's also possible that javascript loaded with this page could be setting an action once the page is loaded based on what application is using the page.
Another likely possibility is that the javascript is handling the onsubmit event. One might do that to prevent the page from reloading or redirecting to a specific page
I guess it's bit late to answer this post. Anyways, I'll what I learnt about this.
If the "action" is not specified in forms, then the Django looks up the HttpResponseRedirect in the corresponding view.
For example, in the example below:
if form.is_valid(): # All validation rules pass
# Process the data in form.cleaned_data
# ...
return HttpResponseRedirect('/thanks/')
Once, the form is validated (and processed), the page is redirected to 'thanks'