Archived

This topic is now archived and is closed to further replies.

Using scripts with XHTML

This topic is 4949 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In the <form> tag, one can assign to the ACTION attrib a file path to an external script. (e.g. <form ACTION="script.url">)I''ve never worked with these before so I just need to understand some fundamental concepts here. Where would I specify that "script.url" is a JavaScript? Inside the file? Somewhere inside the FORM tag as another attrib (like: <form LANGUAGE="JavaScript"....?) Inside the script file, do I have to write anything as a prototype or header that references the specific form it is linked to? And does "script.url" need to be passed any arguments explicitly or do all the NAME attribs get passed automatically as parameters? And one other thing..... :-) How can I instruct an internal JavaScript to read to/write from a text file within the same directory as the XHTML page? I want to make a simple Discussion Forum javascript app and figure the best way is to just have a user form write threads to a text file and have JavaScript read from that file and display them formatted with CSS. Let me know what you think!

Share this post


Link to post
Share on other sites
quote:

How can I instruct an internal JavaScript to read to/write from a text file within the same directory as the XHTML page? I want to make a simple Discussion Forum javascript app and figure the best way is to just have a user form write threads to a text file and have JavaScript read from that file and display them formatted with CSS. Let me know what you think!



Don''t confuse javascript, which is client-side, with something like ASP or PHP, which are server-side. You can''t read a file on the server using javascript. If I understand what you suggest, it is not possible.

Share this post


Link to post
Share on other sites
The script URL should be something like a PHP, ASP, ASP.NET, JSP/Servlet etc script or program located on a web server.

The browser will automatically collect form fields from all active elements in the form - an element is considered to be active if:

- Text boxes, select, text areas and hidden fields are always active
- Radio buttons and checkboxes are only active if they were selected
- Only one button (at most) can be active in a form - it''s only active if it was used to submit the form

It basically takes all the fields, makes them into a POST or GET request (as specified), and sends them to the server.

What the server does with them is its business.

Mark

Share this post


Link to post
Share on other sites