S
sindre
Hi,
Some place I use links to submit forms instead of a submit button. The
way I have done this is: <a
href="javascript:document.getElementById('<?php print "delete$i"
;?>').submit()>Delete?</a>.
This method worked perfectly fine. But then I also wanted to add a confirm
box to the user where. A confirm("do you really want to delete?").
So I made the function:
function controll()
{
if(confirm("Do you really want to delete?"))
{
return (true);
}
else
{
return (false);
}
}
And tried to call the function from inside the submit() like
<a href="javascript:document.getElementById('<?php print "delete$i"
;?>').submit(controll())>Delete?</a>.
This also works fine, but then I have to return the return value. So i
tried
<a href="javascript:document.getElementById('<?php print "delete$i"
;?>').submit(return controll())>Delete?</a>.
And that does not work.
It does work inside the onSubmit="..." then.
So My question is: How could I both use a link inside a form and give the
user the opportunity to regret the choice?
Sindre
Some place I use links to submit forms instead of a submit button. The
way I have done this is: <a
href="javascript:document.getElementById('<?php print "delete$i"
;?>').submit()>Delete?</a>.
This method worked perfectly fine. But then I also wanted to add a confirm
box to the user where. A confirm("do you really want to delete?").
So I made the function:
function controll()
{
if(confirm("Do you really want to delete?"))
{
return (true);
}
else
{
return (false);
}
}
And tried to call the function from inside the submit() like
<a href="javascript:document.getElementById('<?php print "delete$i"
;?>').submit(controll())>Delete?</a>.
This also works fine, but then I have to return the return value. So i
tried
<a href="javascript:document.getElementById('<?php print "delete$i"
;?>').submit(return controll())>Delete?</a>.
And that does not work.
It does work inside the onSubmit="..." then.
So My question is: How could I both use a link inside a form and give the
user the opportunity to regret the choice?
Sindre