# how to add server-side Javascript in a webside page



## samsnov (Jul 16, 2011)

Please how do I add server-side JavaScript in a Contact/comment *form* of my website? 

I am using Dreamweaver.
Thanks for assistance.


----------



## Ent (Apr 11, 2009)

You don't use server-side javascript. It's a language you use at the client side.

If you want to do fancy things server-side, you'll need a language such as PHP (for Linux servers) or aspx (for most Windows servers).

You can use javascript to do things like validate the form's input (so that people don't fill it in only to have the whole message lost because of one mistake), but that runs on their computer. You *should not *rely on javascript validation to make sure that information is safe or correct. Always check it at the server end.


----------



## samsnov (Jul 16, 2011)

Ok thank you but if possible to send you the form code that I used and how it was validated with spry validation thats on Dreamweaver; the validation is fine because was tested on Dreamweaver browser test. Dreamweaver already generated js for the form.
But the problem is that when click on the submit button after filling the form fields it supposed to display a message that there is no internet connection for the message to go, that would be understood but to my surprise on Firefox it opened window life mailing form with my email address attached to it while I did not include email address in the form.

Please kindly look at the attachment,below it shows how it opened windows mailing form when clicked on the submit button, instead of sending it to server direct

below is what it picked along inside the window life form, I didn't write it 

(first_name=sam&last_name=jerry&mail=jerrysamso%40yahoo.fr&comment=introduction&text_field=I+love+your+website&submit=Submit+comment)


----------



## Ent (Apr 11, 2009)

Could you paste the actual code for your contact form into your reply?


----------



## samsnov (Jul 16, 2011)

Thanks, below is the form code, does Doctype/ Meta tag type / content type/title or css type reflect to form reaction on server? below before the form code is the doctype that I used.
I also attached a word file here for a better view.
Red colored is Dreamweaver generated codes when I did the spry validation of the form.
Please you will see it better when you view the file attached

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

website design tutorial

*
*

*
Text your Personal Information here



*

*First Name*

A value is required.

*Last Name*

A value is required.

*E-mail*

A value is required.Invalid format.

*Comment Title :*

A value is required.Minimum number of characters not met.Exceeded maximum number of characters 6-20.

*We so much need your Opinion.*

Minimum number of characters not met.Exceeded maximum number of characters.


----------



## Ent (Apr 11, 2009)

That's why it's trying to send an email.


----------



## samsnov (Jul 16, 2011)

here is the file attached.


----------



## samsnov (Jul 16, 2011)

Oh thank you! I am surprise I didn&#8217;t write that email address I don&#8217;t know how it came along.
Please how do I amend it ?


----------



## Ent (Apr 11, 2009)

You'll need a PHP script to handle the email for you, and post the information to that PHP script.

That said, it's worth checking that your server supports PHP. Where are you having this site hosted?


----------



## samsnov (Jul 16, 2011)

I intend to host with *Ipage*,You see I wanted a situation where a comment would be posted when click on submit button but before this I created an option above the contact form linking my email address for an option to send a comment if the person don't want to fill the comment form.
You can see below the email option that I created before the contact form.
*I don't know anything about PHP, if you could assist me on direction please?*.
But for the comment to be sent if no email address attached (as I am going to remove that email mistakenly attached to the comment form I sent to you),where would it send to I suppose it will send to database,when I have no database yet, if that is the case must I create a database for it.
Please see below the email option I created above the contact form, it works well as I tried it on browser
where my problem lies is to make the coment form to work,thank you.

Compose your comment below or click/copy the E-mail address and paste to your Email composing box to send a comment:.



*Send e-mail to [email protected]*


----------



## Ent (Apr 11, 2009)

I'm afraid I can't write you a customized comment script. You'll find that there are plenty of examples online. A quick google turned up these (I haven't tested them)
http://www.gentlesource.com/comment-script/
http://www.commentics.org/

However iPage isn't advertising PHP support; they list Perl and SSI as their supported "scripting languages". It seems likely that they do, as they offer things like wordpress, but it's definitely worth checking beforehand.


----------



## samsnov (Jul 16, 2011)

Ok I will go online for the php script,I will check the address that you suggested.
But with your exprience and knowledge can you please suggest a better hosting company that would serve me better?
Thanks for help.


----------



## JiminSA (Dec 15, 2011)

Hi Samsnov,

I see you're from Southern Africa and would therefore recommend GridHost, who do support PHP and offer a host (pardon the pun) of other useful pieces of web software (MySQL, phpMyadmin, CloudFlare etc.,)


----------



## samsnov (Jul 16, 2011)

Ok I will be looking into that tomorrow morning, thank you very much.


----------



## samsnov (Jul 16, 2011)

Sorry that site https://sec.gridhost.co.za/ is requesting a username and password before the browser could open the site and I typed in the admin user name and password of my pc but it refused to accept it, so there it went away.


----------



## JiminSA (Dec 15, 2011)

You don't need to log in just yet - simply click on GET STARTED and follow your nose...


----------



## samsnov (Jul 16, 2011)

No you don't understand, the browser refuses to open the page itself, it turns around and open a popup window asking for a username and password, I thought is sort of a security process to the website and filled in my PC administrator name and password yet the site went away and redirect to a blank page with this message below.

*Authorization Required*
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
​ _Apache/2.2.15 (CentOS) Server at sec.gridhost.co.za Port 443_


----------



## JiminSA (Dec 15, 2011)

Ok now I get the picture...
I'm just contacting Gridhost to see what can be done. Thanks for your patience...


----------



## samsnov (Jul 16, 2011)

ok thanks


----------



## JiminSA (Dec 15, 2011)

This is the reply I got from Gridhost...


> HI Jim.
> 
> Due to the fact that we receive VERY high fraud volumes from outside SA, and that our target market is in SA, we have disabled signups on our service from international locations.
> I apologise that we cannot cater to your friend.
> ...


 Sorry Mate


----------



## goodlove69969 (Dec 9, 2012)

Can i run a network server and my home network using the using the same router and internet service provider but use zone alarm as the firewall for the home network and a hardware firewall on the network server.Would i have problems with speed or anything else.


----------



## Ent (Apr 11, 2009)

goodlove, the short answer is probably not because most ISP agreements do not permit you to operate a server on your home Internet connection.

If you want a more in-depth answer from someone with more experience handling servers, you'd be much better off starting your own thread. It just avoids the potential for confusion that can arise if you have two questions being answered at once.


----------



## samsnov (Jul 16, 2011)

JiminSA, Ok thank you for the effort maybe I will look around towards my location *West Africa* to see if there is one available.may God bless you.


----------



## splinner (Dec 13, 2012)

Honestly if your not in Eu or Us a cloud based host would be your best bet. Unless your sites for really local things? But with a cloud based host the vistor connects to the nearest available server then that server connects to them. Basically a relay type of host. There are 2 different type of cloud servers the type i just described and a cloud host thats like a virtual storage. 

Anyhow anything JS is client side. The script interacts with the page its on only sometimes called probable scripts, but JS cant call into a database. It would have to call another script that is able to call from the database then at that point your servers doing double the work.


----------

