homepage Welcome to WebmasterWorld Guest from 54.235.227.60
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Question on Form Tag's Action Attribute
Form Tag Action Attribute
yogimacho




msg:4235814
 2:01 am on Nov 28, 2010 (gmt 0)

Hi,

Someone please clarify my doubt on the following.

Action attribute of form tag has the destination URL.

I see in some websites, the destination URL is not a complete URL and it looks like a Path (/cgi-bin/foldername) which uses post method.

And all the submit buttons in a page have this common path as its action. I tried to see the java script and there is no workaround

1. Is this a security measure?
2. Please give me a head up of how to achieve this!
3. What is the significance of doing the redirection this way?
4. Is there any Language/technical limitations like it works only when this happens.

Thanks in advance for a reply and effort.

 

kaled




msg:4235997
 7:03 pm on Nov 28, 2010 (gmt 0)

The action attribute identifies the form processor - it may also include configuration parameters.

A form processor is much like a console program. It takes as its input the form data and outputs the HTTP headers and the html page that follows.

When the GET method is used, all data is passed by URL which is passed as an environment variable.

When the POST method is used, data is passed via the program input stream.

Javascript doesn't normally come into the equation except when validating data prior to submission.

There is no redirection. It is not a security measure. If you want to write your own form processor, you'll need to learn a CGI language such as Perl.

Hope this helps,

Kaled.

Fotiman




msg:4236276
 2:35 pm on Nov 29, 2010 (gmt 0)

the destination URL is not a complete URL and it looks like a Path (/cgi-bin/foldername)


This is a "relative" URL. The "/" character in the first position indicates that the URL is relative to the root directory of the web site. For example, suppose your form was located at:

http://www.example.com/foo/bar/myform.htm

If you submit to "/" then you're submitting to:

http://www.example.com/

In the example you gave, the form would be submitted to:

http://www.example.com/cgi-bin/foldername

There is nothing special about this.

yogimacho




msg:4236311
 4:07 pm on Nov 29, 2010 (gmt 0)

I thought the same. But throughout the website for any submit button, its just this simple relative path for the action.

I think, putting replied together, this could be the path of the form processor, from where after some security validation of the request, its processed and redirected to the proper URL/web server file.

I am wondering how to figure out the root path, for this relative path.

Fotiman




msg:4236325
 4:37 pm on Nov 29, 2010 (gmt 0)


But throughout the website for any submit button, its just this simple relative path for the action.

So? There's nothing unusual about that.

this could be the path of the form processor

Yes.

from where after some security validation of the request, its processed and redirected to the proper URL/web server file.

A typical form processor will validate input and do whatever it needs to do, and then may or may not redirect to another page. Redirecting can be helpful for keeping the business logic separated from the presentation layer.


I am wondering how to figure out the root path, for this relative path.

The root path is simply http://SITEADDRESS/. As I gave in my example, if the site is at example.com, then the root is:

http://www.example.com/

and the URL that you listed is the equivalent of:

http://www.example.com/cgi-bin/foldername

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved