Thirusha 20 Posting Whiz
window.open("www.google.com", "_parent")

will make the page open in the same window. so according to your code this should work :

winslide=window.open(slidelinks[whichlink], "_parent")

You have said u have tried, it, so from the code that u have provided i cant see what could be wrong, please provide the full html as well,

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

so why isnt it marked as solved then?

Thirusha 20 Posting Whiz

One cant use client side code to get the server side code, if u try printing out the userId it should be there. what u can do is assign the userId to a hidden field then alert the value of the hidden field.

Thirusha 20 Posting Whiz

i don't think the onsubmit function is being performed as it is on the button, and if your button is of type submit it will submit the form immediately, have you tried placing the onsubmit function on the form?
another question, after the form submits, the page that it submits to, does it have the field you are sending the focus to?

Thirusha 20 Posting Whiz

where is your form submitting to, it could be that when the form submits, the element is no longer on the page or not in the same place as it is before it is submitted there it is being set to the top of the page.

could u include your entire code please

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 dont know PHP, but what u can do is alert the variables before u put them inside the url variable.

Also i think your ajax code is incorrect, this

request.onreadystatechange = parseResponse(request);

should be:

request.onreadystatechange = parseResponse;

You dont need to send the request variable to that function. also the function parseResponse would then not accept a variable.

Thirusha 20 Posting Whiz

I don't think your code was going to work the way you want it to.
so i have tweaked your code to this:

<script>
function checkAll(formObj)
{
	var obj = document.forms[formObj];
	//obj[0] = document.getElementById("name");
	//obj[1] = document.getElementById("psw");

	//alert(obj.length);

	for (i=0; i<obj.length; i++)
	{

		  if (obj[i].value == "")
		  {
			//alert("inside formObj here111");

			alert("Input item on Row #"+(i+1)+" has been left empty. Please make sure you input something into this field.");
			obj[i].focus();
			return false;
		  }

	}
	document.forms[formObj].submit();
}
</script>
<form action="login.php" method="post" name="postingForm" id="postingForm" >
						<label>Username<br /><input id="input1" type="text" name="username" /></label><br />
						<label>Username<br /><input id="input1a" type="text" name="usernamea" /></label><br />

						<label>Email<br /><input id="input2" type="text" name="email" /></label><br />

						<label>Password<br /><input id="input3" type="password" name="pswd1" /></label><br />

						<label>Password Again<br /><input id="input4" type="password" name="pswd2" /></label><br />

						<input type="button" name="submitbtn" value="Submit" onclick="checkAll('postingForm')" />

						<input type="reset" value="Reset" />

						</form>

I have added an extra field just to see if it works if you add more fields.

I think it is safer to have a normal button instead of a submit button(type="submit"), and use an onclick event because a submit button will always submit the form, even if there are errors, and no one wants that, it is very dangerous.

try it out, and let me know what you dont understand, and i can explain why i did it that way.

Thirusha 20 Posting Whiz

As far as I know there is no such thing as getElementsbyId there is only getElementById .

The id's have to be unique, see also w3schools

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

Why dont you just send the name of the element or id of the element in to the onchange function, send the element using "this", so the function call could be something like this :

... onchange="callMe('elementId')"

or

... onchange="callMe(this)"

Then inside the callMe function u will then have the element ID or the element object available to you.

Thirusha 20 Posting Whiz

My pleasure, please mark this thread solved if your question has been answered to your satisfaction.

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

NoclassDefError, normally stems from not being able to find the class, in your case TagLibraryValidator

Ensure that this class is in the lib directory of your application

Thirusha 20 Posting Whiz

@Peter_budo, based on his question, i think that i am correct in saying that it cant be done, one can use ajax, but you will still need a server side language, one cannot connect directly to the database just using javascript.

Thirusha 20 Posting Whiz

I dont think you can do that, you are going to need a server side language, like ASP, Java, PHP etc that will be able to communicate with the database.

Thirusha 20 Posting Whiz

By numeric validation do u just want to validate that numeric characters were entered in the form?

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

I see that your original problem http://www.daniweb.com/forums/thread229724.html has been solved please mark that as solved so that people dont answer a thread that has already been solved.

Now onto your new problem, the code that is causing your page to open in a new window on page3.html is this:

<a href="page4.html">click</a>

What u need to do is call the same ajx function you use in the menus.

<a style="cursor:pointer" onclick="open_page('page4.html','content')">click</a>
Thirusha 20 Posting Whiz

I dont know anything about tripod/lycos but from the code you have provided, in order to change where the page goes to after submission, you are going to have to edit the file referred to in teh action atttribute.

As to why the submit button is greyed out, unfortunately nothing in the code provided can explain that one.

Best thing will be to contact their support and not give up until they answer you.

Thirusha 20 Posting Whiz

when using teh insert statement, the fields that do allow nulls have to be listed in teh statement, with teh correspoding values. So if all the fields in the db were designed to accept a value, then they have to be listed in the statement.

They do not have to be in the same order they are in the database.

Thirusha 20 Posting Whiz

My pleasure.

Please mark this thread as solved.

Thirusha 20 Posting Whiz

I have tried many times and just do not know if it is possible to access the index page's ajax code from the div content.

Yes it is possible, if your script is on the index page, it is also available to the new html that has just been loaded into your div.
Just call the same function that you did the first time you load content into the div.

Thirusha 20 Posting Whiz

Try using the colspan parameter, this merges the columns.

Thirusha 20 Posting Whiz

I just replied to your other thread with the same question in the php forums.

Thirusha 20 Posting Whiz
var url = "servlet";
var params = "name=Bob";
http.open("POST", url, true);
http.send(params);

I have left out the parts of the ajax code that would normally remain the same.
There are loads of information on the net regarding ajax post if you are still lost, I used this site a while ago: http://www.openjs.com/articles/ajax_xmlhttp_using_post.php

Thirusha 20 Posting Whiz

You are not sending the username to the servlet, you ahve to post the form to the servlet or in the ajax function send the username in the url, so the url would look something like this:
http://localhost/servlet?username=Bob

Thirusha 20 Posting Whiz

pleasure, glad to help

Thirusha 20 Posting Whiz

I cannot be sure(you have provided no code), but most probably the button that you are using to submit is of type submit, change the button to type button then and an onclick event and call your javascript function.

Thirusha 20 Posting Whiz

getParameter only works if the parameter you are accessing exists in the URL that was sent to the servlet.

Are you sure that the array is being sent to the servlet?

If the url is this : "/jspservlet?name=blah&myArray={1,2,3}" (the curly brackets would be replaced with the correct url encode for brackets which would be %something), then using request.getParameter("myArray") would return the array.

Thirusha 20 Posting Whiz

Try using the onload event when the page loads, place the onload event on the body tag.

Thirusha 20 Posting Whiz

Try these two links, I havent tried them, but they seem to be pretty good
http://www.devarticles.com/c/a/Java/J2EE-and-AJAX-AJAX-with-Servlets/

http://www.java-tips.org/java-ee-tips/enterprise-java-beans/using-ajax-with-java-technology.html

There are also loads of examples out there, you just have to search for them.

When i first started learning jsp, I came across a lot of examples that were incomplete, dont be discouraged though, just try solving them yourself, google helps a lot, a lot of the errors are newbie errors. but you will get the hang of it.

Thirusha 20 Posting Whiz
<%String sID = request.getParameter("id");%>

Use the same code for the other parameters, remember to change the name of the String though.

Thirusha 20 Posting Whiz

Adding the username and password to the javascript function is easy, just send those two values to the function itself, and ensure that the function accepts two inputs.

I dont see anywhere in your code where u are using request.getParameter("id") ??

I wouldnt send in the username and password in the javascript function unless you are going to need them for some purpose, not the purpose of posting them to the next page only, in the function.

You dont need to place comment out the javascript in the script tags anymore. Also it is better practice to use a servlet to connect to the database then doing it through a jsp.

I cant see any reason why the information is not getting posted to the next page.

Thirusha 20 Posting Whiz

It should work if the form is posting correctly, can u post the code of both the pages, and I can take a look.

Thirusha 20 Posting Whiz

I see you are posting to a html page. request.getParameter will only work server side, that is not on a html page but rather on a jsp page.

Thirusha 20 Posting Whiz

It would work in the same way as above, that is place the response in an area on the page.

Remember to mark the thread solved once your question is answered so that other users dont reply to a thread that is in fact solved.

Thirusha 20 Posting Whiz

Ensure that those fields are within the form tags on the page you are submitting

Thirusha 20 Posting Whiz

I think you should change the button on the Actions.html page from a type submit to a type button, then add an onclick event, this way it will let u know if something is wrong, with a type submit, the page will always submit.

I played around with the code u provided, and i think u should change the following on the Actions.html page, add the function that u validate the input, and change the button to this:

<input type="button" value="submit" onclick="valtext(document.getElementById('username').value)" />

<script>
function valtext(val)
{
 if(val == "")
 {
  alert("Form is not filled");
  parent.FrameSet1.document.getElementById("ff").innerHTML = "Form is not filled";
  return false;
 }
 else
 {

  return true;

 }
}
</script>

I added a div tag to the FrameSet.html page.

You were on the right track, the reason for your function not working was that the function required a variable to be passed to it, which you didnt supply.

What helps alot when coding in javascript in Firefox's Firebug, try and get it.

Thirusha 20 Posting Whiz

in the ajax function, where you process the response, you will set the innerhtml of that frame to be the response.
something like this,

document.getElementById('frameId').innerHTML = req.responseText

You can post the code that u have so far, and i shall take a look.

Thirusha 20 Posting Whiz

Start with the basics, create a page with three frames.
Then go to http://www.w3schools.com/Ajax/ajax_example.asp, play around with the example.

You can use the same ajax code that is provided on that site, and incorporate it into the page with the three frames.

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

Can u give an explanation of what the problem is?

I have tried this, and on the onmouseover event, the innerhtml is changed. I had removed the images and just places text since i dont have the images.

Thirusha 20 Posting Whiz

I dont use MS Sql anymore, but as far as I can remember the data will NOT be automatically inserted. You have to insert the data.

There has to be data in the table which references the foreign key, so in your case the department table has to have valid data. Then when inserting records into the Employee table the correct department id must be used.

I suspect that u cannot insert records into the employee table as u dont have any records in the department table.

Thirusha 20 Posting Whiz

I think u should provide some code, then we can help when u get stuck.

Thirusha 20 Posting Whiz

Pleasure

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

I could be wrong but i dont think there is one, as far as I know, when u use

navigator.appName

, the result in Mozilla will be Netscape.

So if the code checks for Netscape it would work in Firefox