Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
value submission problem script
Old 09-21-2006, 05:52 PM value submission problem script
Average Talker

Posts: 18
Trades: 0
<script language="javascript">
function submitF()
{
document.facilityForm.submit();
}
</script>
<html:form action="/iata">
Facility: <html:select property="facility"
name="facilityForm" size="1" onchange="submitF()">
<htmlption value="state">state</htmlption>
<htmlptions property="facilityList"
name="facilityForm" />
</html:select>
Hi I have a form conatining values which is submitting
though above script.
Now I have put a default value as "state"
when user select any other value excpet default then
corrosponding page is displayed but if user choose default
value there is error obviously.
I simply want that if user select default value "state"
nothing should be submitted.
please be specific if anyhting need to be chnaged in
javascript as no idea about javascript
regards
somsahi is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-21-2006, 10:52 PM Re: value submission problem script
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
I don't know why you have html: inside all your codes and AFAIK "property" is not a valid property for an option tag. But this will check the form field before submitting:

HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>

	<head>
		<title>Untitled Page</title>
<script type="text/javascript"><!--
function submitF(fValue) {
	if (fValue != "") {
		document.facilityForm.submit();
	} 
}

//--></script>
	</head>

	<body>
<form action="/iata" name="facilityForm">
	Facility: <select name="state" size="1" onchange="submitF(this.value);">
				<option value="">Choose Your State:</option>
				<option value="NJ">New Jersey</option>
				<option value="NY">New York</option>
				</select>
	</body>

</html>
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 09-22-2006, 12:28 PM Re: value submission problem script
Ultra Talker

Posts: 256
Location: Auckland, New Zealand
Trades: 0
I take it this is JSP, just for funkdaddu. I don't know if you understand namespacing, but prefixing elements with html: is just specifying that the element is that of html, usually only used when the default documents namespace is different. Basically in xml documents, you would have xmlns:html="http://www.w3.org/1999/xhtml" which tells us we will be using xhtml elements prefixed by html. The default xmlns=... is probably a different value.

I'm no JSP expert, but it's possible in this case that the property value could exist. Though it's not correct in W3C standards but that does not mean a custom doctype can be used to make it a valid document.

You should disable the element and then try working with funkdaddu's code to help you.

Cheers,

MC
__________________
#------------------------------signature---------------------------------------------------------------------------------#
Quote:
I am well recognised for what I don't do than what I do. Chores are just one of those things.
mastercomputers is offline
Reply With Quote
View Public Profile Visit mastercomputers's homepage!
 
Old 09-22-2006, 02:57 PM Re: value submission problem script
Average Talker

Posts: 18
Trades: 0
for benefit of others

<script language="javascript">
function submitRegion()
{

var ind = document.regionForm.region.selectedIndex;

if ( ind == 0)
{
alert('Please select the required region ..');
return;
}
else
{
document.regionForm.submit();
}
}
</script>
somsahi is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to value submission problem script
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16849 seconds with 12 queries