Hi all,
I get the tough problem and expect to get help..
In a html page, I dynamically created many forms which named as
NO+business_id. In each form there are two submit buttons to
"release_or_not". of course in the server side I validate those values
as well. However, because this page is for admin to use so that I do
not need to care any hacker action. Hence, in the client side
javascript I validate those values and give it a popup report window
to confirm.
Now the problem comes. The javascript does not know which button I
clicked. Therefore I make a onclick function in setAction
<input type="submit" value="Release" name="release_or_not"
onClick="return setAction(1)">
<input type="submit" value="Reject + Delete Entry"
name="release_or_not" onClick="return setAction(2)">
and a hidden variable called ddd
<input type="hidden" name="ddd" value="" >
after clicking a submit button, it calles the setAction function
before onsubmit isValid function of the form. In setAction function, I
want to set the hidden ddd variable to "Release" or "Reject + Delete
Entry", so that it is the alternative way for the validation function
to know which submit button I clicked.
function setAction(act)
{
if(act == 1)
{
x.ddd.value = "Release";
return true;
}
else if(act == 2)
{
x.ddd.value = "Reject + Delete Entry";
return true;
}
else
{
return false;
}
}
as you see, currently I do not know in which form it is. I ever create
the setAction(this,1).. and expect "this" can be the form.. but
failed..
I have no idea now.. any comment will be greatly appreciated..
with best wishes
sandy