Javascript error

Hi,

I have a little javascript code that validates if a value has been entered into two fields. I havent changed any settings on the form, I just added two fields .

When I run it with notes web then i get:

Javascript error mo refference validateText not defined.

When I run it with IE I just get in the statusbar error on the page.

Here is the code

Thanks

function validateForm()

{

var f = document.forms[0];

if (validateText(f.UsrNm, ‘Username’) == false)

{

		alert("Unesi Username");

		return false;

}

if (validateText(f.Pswrd, ‘Password’) == false)

{

		alert("Unesi Password");

		return false;

}

	return true;

}

Subject: Javascript error

We don’t see your validateText() function.Chances are this function got Error or not defined

Subject: RE: Javascript error

I am using part of the code from the guy that worked before me here.

I thought validaText where a javascritp method? I cant find it on the database where it works?

Are there any other javascript ways I can acomplish the validation?

Does it make any difference for the validation if the password field isnt text, it is password with red borders.

Thanks

Branimir

Subject: RE: Javascript error

Ok…ValidaText is not a javascript method.

The basic code to validate fields is -

For text fields -

if (document.forms[0].fieldname.value == “”)

{

alert("Please enter some value in field");

document.forms[0].fieldname.focus();

}

For select (combo) fields -

var f = document.forms[0];

if (f.fieldname(f.fieldname.selectedIndex).text == “”)

{

alert("Please enter some value in field");

document.forms[0].fieldname.focus();

}

Replace the “fieldname” above with the original file name of yours.

Password field is just like a text field, so you can implement the above code for text field.

–Phani

Subject: RE: Javascript error

Thanks Mr. Kiran your answer was brief and efficient.

Can I ask you another question?

Can i create a user on the notes server and when he enteres the database over the browser he enteres the name of his userID and his userdID password and he is loged in just like when he logs in over the client?

Is it complicated?

Thank you

Subject: RE: Javascript error

Not at all complicated.

Follow these steps -

  1. Create a new person document in Domino names.nsf.

  2. That person document includes two crucial fields -

User Name - Include the user name of the user here. It can be like “Brane Mxm/domainname” or “Brane Mxm”.

and

Internet Password - Type out the internet password here. This is what the user will enter when he logs on web. For example, set this field value to “Brane”.

  1. Save the person document. (Probably you need to wait for some time for the changes to become active).

Then create a new database or open an existing database like this -

http://servername/database.nsf?login

Which will force the user to login page. Enter your username and password set above. This would make domino to check the credentials and then allow you to access the database.

If you want the login page to appear automatically then set the following in database ACL -

  1. Default access to “No Access”

  2. Create a new entry and name it as “Anonymous” and set it to “No Access” (Actually Anonymous access is exclusively used for web and Default access for client)

That’s it.

–Phani

Subject: RE: Javascript error

That seems great to me, could you please take a look at my post I posted few minutes ago.

What would be the better solution (and easier) for me?

I think that your solution would be the right one.

Could I then do all the things taht i planed in my post with lotusscript? Or would I still need javascript(I dont know anything in javascript)

http://www-10.lotus.com/ldd/nd6forum.nsf/DateAllThreadedweb/d7fd6a261e81c4768525725e0035a902?OpenDocument

Thank you, you are a great help