Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

It is I, Erick...and I'm back with more Newbie-thing

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

It is I, Erick...and I'm back with more Newbie-thing

Postby Erick020 » Sun Dec 29, 2002 11:45 am

Well, well, well... I've been busy today !

This is the last thing I found : After all trouble I have had to print a quiet complex and very long form, I'd like to be able to delete some items on this form !
Isn't it cool ?!?!?! :evil:

So this is the script I do not want to use:

1] In the head tag:
<SCRIPT LANGUAGE=JavaScript>
function myconfirm( Item )
{ return confirm("Are you sure you want to delete "
+ Item + " ?");
}

2] Far further on, somewhere in this very long script...
echo "<form method=post action=
Delete_Item.php name=fdelete>\n";
echo "<input type=Hidden name=\"Item\" VALUE=
".$r["Product_Name"].">\n
<input type=button name=_submit value=Delete
onClick=\"if(myconfirm('".$r["Product_Name"]."')){document.fdelete.submit();}\">".$r["Product_Name"]."
</form>\n";

3] The result:
It looks great, when you click on the Delete button, you get the right warning with the right name, BUT.... If you click on OK
you get the most famous JAVASCRIPT ERROR ever invented :
THE Famous ERROR RUNTIME - This method is not supported by this object, do you want to debug? SoI did, and it point to the function itself "{document.fdelete.submit();}" ...

If somebody out there can tell me, even better show me what I do wrong, it will be a release for me and my over-heated brain.
Thanks to all of you,
Erick.
Erick020
New php-forum User
New php-forum User
 
Posts: 13
Joined: Thu Dec 26, 2002 6:20 am

Postby Joan Garnet » Sun Dec 29, 2002 2:18 pm

I would use only this:

No external javascript functions are called, all in the form tag -->

Code: Select all
<form method="post" action="Delete_Item.php" name="fdelete" onsubmit="if (confirm('Are you sure you want to delete?')){ return true }else{ return false }">


bye
:)
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

Postby Erick020 » Sun Dec 29, 2002 5:48 pm

Joan Garnet wrote:I would use only this:

No external javascript functions are called, all in the form tag -->

Code: Select all
<form method="post" action="Delete_Item.php" name="fdelete" onsubmit="if (confirm('Are you sure you want to delete?')){ return true }else{ return false }">


bye
:)


Thanks a lot... it's indeed easier, the only thing that I liked in the function I wrote is that I could retrieve the name of the object in the confirm dialog window.

I just start now the almost final touch.... I have to print different dates on the order form, like Down Payment (due before + 10days after order date), the balance (+30days after order date).... I'll let you know.
Thanks again for your precious help.
Bye,
Erick.
Erick020
New php-forum User
New php-forum User
 
Posts: 13
Joined: Thu Dec 26, 2002 6:20 am


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.