473,387 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

javascript return true or false

In my jsp code I have an image which if someone clicks on that it
stores data like "string1" in the hidden field that I have defined on
page as:

<html:hidden property="selectedOfficeType" value="" />

later when I click save button (with the following code:)

<input id="saveButtonId" type="button" value="Save"
onclick="javascript:save('counter')" class="mainBody"/></td>

this calls a method defined in javascript like this:

function save(counter){
func1(arg0)
document.form.submit();
}

function func1(arg0){
func2(arg1)
}

function func2(arg1){
line1
line2
line3
}

if I put alert in save method like alert("selectedOfficeType:
"+selectedOfficeType) Then it alerts "string1" as expected; if I put
alert in func1, I get "string1" and if I put alert in funct2 before
line1 or before line 2 I get the value "string1"

But the problem is that for some reason I don't get it (alert prints
undefined) after line2 or before line 3 and there after if I put alert
back in save method after making calling to func2 I get "undefined" as
the value.
Even if I comment out line 2 and line 3, it still prints out as
undefined. For some reason the value returned by alert in the begining
of the func2 is fine but towards the middle of the method it starts
alerting me "undefined" and thereafter back in save method it alerts
"undefined".

Could someone please help me with this; thank you so much.
-raj.

Jul 23 '05 #1
1 4195
ASM
rk******@gmail.com wrote:
For some reason the value returned by alert in the begining
of the func2 is fine but towards the middle of the method it starts
alerting me "undefined" and thereafter back in save method it alerts
"undefined".


if anything wrong in line 2 or 3 that would have to work

it does work with that :

<html>
<script type="text/javascript">
function save(counter){
var arg0;
func1(arg0)
document.forms[0].submit();
}
function func1(arg0){
func2(arg0)
}
function func2(arg1){
line1=''
line2=''
line3=''
say();
}
function say(){
msg = document.forms[0].selectedOfficeType.value;
alert('selectedOfficeType = '+msg);
}
</script>
<form action="test.html" target="_blank">
<input type="button"
onclick="selectedOfficeType.value='string_1';"
value="fill hidden">
<input type="button" value="Save"
onclick="save('counter')" />
<input type="button"
onclick="selectedOfficeType.value='';"
value="empty hidden">
<input type="hidden" name="selectedOfficeType" value="" />
</form>
</html>

--
Stephane Moriaux et son [moins] vieux Mac
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Sue | last post by:
After finishing up my first quarter JavaScript on 12/12/03, I decided to improve character checking on my project. In my project I only had to do very basic validation. Therefore, I only had one...
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
2
by: joelkeepup | last post by:
Hi, I made a change this morning and now im getting an error that says either "a is undefined or null" or "e is undefined or null" the microsoft ajax line is below, I have no idea how to...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.