Thirusha 20 Posting Whiz

Do you want someone to code that for you? or are you stuck somewhere trying to put your plans into action?

Thirusha 20 Posting Whiz

1 sets the variable obj to an array of the form that is supplied within the square brackets, if there is nothing in the brackets and it is written like document.forms[] you will then have access to all forms on the page. I think this gives a better explanation.

the name and ID of an element does not have to be the same, it must just be unique. naming(name and id) it the same thing is just easier for me. I found a nice link that explains all the form attributes.

it goes to login.php cause that what u specified in the form action attribute, i didnt change that.

I am not sure how php works, but once you submit the form, all fields should be available for you to access on the login.php page, it works that way for other server languages as well.

All that

document.forms[formObj].submit();

does is just submit the form, the same way have a submit button would submit the form.

mr_scooby commented: awesome helper +2
Thirusha 20 Posting Whiz

I think it is better that you give all the fields unique id's.
If the fields are not going to change and not increase at any time, then you could just do a basic if else statement.
If the fields are going to increase then just loop through them, first you have to determine the length of the fields in the form.

var form1 = document.forms[formName]
//formName being the name of the form
for (i = 0; i < form1 .length; i++) {
inp= form1 .elements[i];
if (inp.value.length == 0){
alert("Please enter value in field" + inp.name);
}
}

this is by no means 100% correct code, it may need some tweaking, its just to give u a direction to go in.

Thirusha 20 Posting Whiz

Nope, Ajax is client side, so no need to do any server side configurations.

network18 commented: precise explaination :) +1
Thirusha 20 Posting Whiz

You weren't really calling the function, it starts running when the page loaded. I see that you are changing the href attribute to a hash inside the loop, so i modified your code to look like this:

<html>
<body>
<form>
<a  onclick="change(this)" id="static" href="#">link1</a></br>
<a  onclick="change(this)" id="static" href="#">link2</a></br>
<input type="text" id="spec" name="content"/>
</form>
<script>
	function change(object){
		var inputobj = document.getElementById("spec");
		inputobj.value = object.innerHTML;
	}
</script>
</body>
</html>

If u click on the links than that "innerhtml" is displayed in the textbox.

I had removed the loop since there was no need to have it, as all u want to achieve is click on the link and the value appear in the text box

Thirusha 20 Posting Whiz
use DATABASE_NAME

SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
Thirusha 20 Posting Whiz

They will show the same name because you can only hard code one element id, what u can do is this:

onmouseover=fu(this)

then in the javascript function change it to this:

function fu(el){
alert(el.name);
}

by sending in the this property u are sending the element object to teh function and thus will be able to retrieve any attribute of that element.

Thirusha 20 Posting Whiz

Please read the rules of this forum here
You need to ask a specific question with regard to an error that you are getting, otherwise no one is going to help you.

If you need to learn html, w3schools is a good place to start

Thirusha 20 Posting Whiz

Wouldn't it be easier to have a table in the database to hold the restricted names, and then just query that table.

Thirusha 20 Posting Whiz

I dont have code, since this is very simple, the textbox you are refering to is most probably from a html page. so all you have to do is surround it with form tags, then in the action parameter place the url for the servlet, the button you can either have it as type submit or if it is of type button, add an onlick event then use document.formname.submit;
formname being the name of the form which surrounds the text box.

Thirusha 20 Posting Whiz

Why dont you rather replace the double quotes with single ones in the code, thus eliminating the need for the user to retype.

Thirusha 20 Posting Whiz

Have u been able to come up with anything?
Ajax isnt difficult. try w3schools' website.

deadmancoder commented: Thanks girl +1
Thirusha 20 Posting Whiz

Go to http://dev.mysql.com/downloads/

The latest version of the community server (this is under the GPL licence) and it should work fine.
I dont remember having to put anything in the environment variables but there is documentation about how to install the server, its pretty simple though.

kvprajapati commented: ..you googled it for ishlux. +13
Thirusha 20 Posting Whiz

w3schools is pretty good.

http://www.w3schools.com/JS/default.asp

laura_ci commented: Thank you for the help +1
Thirusha 20 Posting Whiz

There is a class called BufferedReader which you can use. You can try this code, i had it lying around, so i hope it still works, havent had to do such things in a long time:

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String input = br.readLine();
    System.out.println(input);
    br.close();
JameB commented: thanks! +1
Thirusha 20 Posting Whiz

If the redirect is to look like this

response.sendRedirect("welcome.jsp?name="+userName);

then to get the username from the query string you would use it just as u did earlier (from your original post "String userName = ......") , like this:

<%=request.getParameter("name")%>
Thirusha 20 Posting Whiz

your id/name is just for use in your form dosent suit any purpose for the validation I gather?

I tend to always put the id and name attributes in, whether i use them or not, but for the example it was used in the submission of the form.

I hope it works for u :)

OmniX commented: saved me when no one else could! Thankyou so much! +1