Re: [PHP] Link acting as a submit button
* Thus wrote Matt Palermo ([EMAIL PROTECTED]): I am trying to create a submit button out of a hyperlink using the following code: (this is in a file called index.html) A href=javascript:go_where_my_variable_says('this.php');this page/a SCRIPT LANGUAGE=JavaScript !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT This works fine as an html document, however, when I try to echo the same code out in a PHP page, it gives me javascript errors. I am using the following to echo it out in PHP: echo A href=\javascript:go_where_my_variable_says('this.php');\this page/a SCRIPT LANGUAGE=\JavaScript\ !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT ; No need to echo out the statement, better to use this method so you dont have to escape each and every existing: // leave php to output html ? A href=javascript:go_where_my_variable_says('this.php');this page/a SCRIPT LANGUAGE=JavaScript !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT ?php // now back in php mode This displays the link fine for the submit hyperlink, but it gives the javascript error: Error: Object doesn't support this property or method. Code: 0 Like I said before, this code works perfectly fine if I have it an html document. Anyone got any ideas? With that being said I dont see a php problem here. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Link acting as a submit button
I have tried this method as well, but I still seem to get the same error. I have the form tag put in there and everything, with this bit of script inside the tags, but still no luck. Is there an easier way to accomplish what I want to do? Please let me know if there is. Thanks. Matt = Original Message From Curt Zirzow [EMAIL PROTECTED] = * Thus wrote Matt Palermo ([EMAIL PROTECTED]): I am trying to create a submit button out of a hyperlink using the following code: (this is in a file called index.html) A href=javascript:go_where_my_variable_says('this.php');this page/a SCRIPT LANGUAGE=JavaScript !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT This works fine as an html document, however, when I try to echo the same code out in a PHP page, it gives me javascript errors. I am using the following to echo it out in PHP: echo A href=\javascript:go_where_my_variable_says('this.php');\this page/a SCRIPT LANGUAGE=\JavaScript\ !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT ; No need to echo out the statement, better to use this method so you dont have to escape each and every existing: // leave php to output html ? A href=javascript:go_where_my_variable_says('this.php');this page/a SCRIPT LANGUAGE=JavaScript !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT ?php // now back in php mode This displays the link fine for the submit hyperlink, but it gives the javascript error: Error: Object doesn't support this property or method. Code: 0 Like I said before, this code works perfectly fine if I have it an html document. Anyone got any ideas? With that being said I dont see a php problem here. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Link acting as a submit button
I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Matt = Original Message From Matt Palermo [EMAIL PROTECTED] = Fixing the javascript that you specified still gave me the same errors... Got any more suggestions? Thanks for your help, Matt -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 6:40 PM To: Matt Palermo Subject: Re: [PHP] Link acting as a submit button Your javascript is wrong. change this document.forms[0].action = where; to this document.forms[0].action.value = where; Jim Lucas - Original Message - From: Matt Palermo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 24, 2003 3:35 PM Subject: [PHP] Link acting as a submit button I am trying to create a submit button out of a hyperlink using the following code: (this is in a file called index.html) A href=javascript:go_where_my_variable_says('this.php');this page/a SCRIPT LANGUAGE=JavaScript !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT This works fine as an html document, however, when I try to echo the same code out in a PHP page, it gives me javascript errors. I am using the following to echo it out in PHP: echo A href=\javascript:go_where_my_variable_says('this.php');\this page/a SCRIPT LANGUAGE=\JavaScript\ !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT ; This displays the link fine for the submit hyperlink, but it gives the javascript error: Error: Object doesn't support this property or method. Code: 0 Like I said before, this code works perfectly fine if I have it an html document. Anyone got any ideas? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link acting as a submit button
[EMAIL PROTECTED] Matt Palermo: I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Matt No, it doesn't... well it shouldn't anyway. Check the source code of the outputted page. Is it exactly what you want it to be? If not, you might want to try using single quotes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Link acting as a submit button
Actually, I found out what the problem is. I have a normal submit button in the same page, however when I take out the submit button, the javascript code works fine. When I put the submit button back in, I get the error again. Is there a fix for this, or do I need to make the submit button into a link instead? Thanks, Matt = Original Message From Comex [EMAIL PROTECTED] = [EMAIL PROTECTED] Matt Palermo: I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Matt No, it doesn't... well it shouldn't anyway. Check the source code of the outputted page. Is it exactly what you want it to be? If not, you might want to try using single quotes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link acting as a submit button
[EMAIL PROTECTED] Matt Palermo: Actually, I found out what the problem is. I have a normal submit button in the same page, however when I take out the submit button, the javascript code works fine. When I put the submit button back in, I get the error again. Is there a fix for this, or do I need to make the submit button into a link instead? Thanks, Matt But you say it works in a HTML page. So I still think you should check if the output is right. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link acting as a submit button
what is the javascript on it? sorry, missed the start of the thread... - Original Message - From: Matt Palermo [EMAIL PROTECTED] To: Comex [EMAIL PROTECTED]; php-general [EMAIL PROTECTED] Sent: Friday, July 25, 2003 1:05 PM Subject: RE: [PHP] Link acting as a submit button Actually, I found out what the problem is. I have a normal submit button in the same page, however when I take out the submit button, the javascript code works fine. When I put the submit button back in, I get the error again. Is there a fix for this, or do I need to make the submit button into a link instead? Thanks, Matt = Original Message From Comex [EMAIL PROTECTED] = [EMAIL PROTECTED] Matt Palermo: I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Matt No, it doesn't... well it shouldn't anyway. Check the source code of the outputted page. Is it exactly what you want it to be? If not, you might want to try using single quotes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link acting as a submit button
[EMAIL PROTECTED] skate: what is the javascript on it? sorry, missed the start of the thread... http://tinyurl.com/i0un -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link acting as a submit button
(this is in a file called index.html) A href=javascript:go_where_my_variable_says('this.php');this page/a try this a href=javascript: go_where_my_variable_says('?php echo $PHP_SELF;?');this page/a -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Link acting as a submit button
On Fri, 2003-07-25 at 05:30, Matt Palermo wrote: I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Yes it matters tons with the javascript call. Here is some info on it...however, these questions are now javascript and not php... 1. make sure you pass in a valid page to your function. 2. make sure that you have a form that you are accessing. 3. make sure that when you access the form you are accessing the correct frame page. Example: when you set up the frames use the name attribute to assign names to the frames... so if you have a frame named frame1...then you can do this... frame1.document.forms[0].action.value = where; frame1.document.forms[0].submit; I might be off on this a little but that should get you started in the right direction. -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Link acting as a submit button
I found out that it works fine without the submit button that I had in there. When I take the submit button out, it works, if I put it back in there I get the error message again. Any ideas? Matt = Original Message From [EMAIL PROTECTED] = On Fri, 2003-07-25 at 05:30, Matt Palermo wrote: I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Yes it matters tons with the javascript call. Here is some info on it...however, these questions are now javascript and not php... 1. make sure you pass in a valid page to your function. 2. make sure that you have a form that you are accessing. 3. make sure that when you access the form you are accessing the correct frame page. Example: when you set up the frames use the name attribute to assign names to the frames... so if you have a frame named frame1...then you can do this... frame1.document.forms[0].action.value = where; frame1.document.forms[0].submit; I might be off on this a little but that should get you started in the right direction. -- BigDog -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Link acting as a submit button
[snip] I found out that it works fine without the submit button that I had in there. When I take the submit button out, it works, if I put it back in there I get the error message again. Any ideas? [/snip] Are you naming the submit buttons? Not just value, but id or name? You must keep them seperate. HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Link acting as a submit button
Why do you have a submit button and a link to submit the form. Dont u want them to use the submit button for the form? -- BigDog On Fri, 2003-07-25 at 09:02, Jay Blanchard wrote: [snip] I found out that it works fine without the submit button that I had in there. When I take the submit button out, it works, if I put it back in there I get the error message again. Any ideas? [/snip] Are you naming the submit buttons? Not just value, but id or name? You must keep them seperate. HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Link acting as a submit button
Okay, I got it to work. I just put the id parameter in the submit button tag and it works fine now. Thanks for all your help guys... = Original Message From [EMAIL PROTECTED] = Why do you have a submit button and a link to submit the form. Dont u want them to use the submit button for the form? -- BigDog On Fri, 2003-07-25 at 09:02, Jay Blanchard wrote: [snip] I found out that it works fine without the submit button that I had in there. When I take the submit button out, it works, if I put it back in there I get the error message again. Any ideas? [/snip] Are you naming the submit buttons? Not just value, but id or name? You must keep them seperate. HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link acting as a submit button
Depends, are you trying access the form from a different frame? Jim Lucas - Original Message - From: Matt Palermo [EMAIL PROTECTED] To: Jim Lucas [EMAIL PROTECTED]; Matt Palermo [EMAIL PROTECTED]; php-general [EMAIL PROTECTED] Sent: Friday, July 25, 2003 4:30 AM Subject: RE: [PHP] Link acting as a submit button I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Matt = Original Message From Matt Palermo [EMAIL PROTECTED] = Fixing the javascript that you specified still gave me the same errors... Got any more suggestions? Thanks for your help, Matt -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 6:40 PM To: Matt Palermo Subject: Re: [PHP] Link acting as a submit button Your javascript is wrong. change this document.forms[0].action = where; to this document.forms[0].action.value = where; Jim Lucas - Original Message - From: Matt Palermo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 24, 2003 3:35 PM Subject: [PHP] Link acting as a submit button I am trying to create a submit button out of a hyperlink using the following code: (this is in a file called index.html) A href=javascript:go_where_my_variable_says('this.php');this page/a SCRIPT LANGUAGE=JavaScript !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT This works fine as an html document, however, when I try to echo the same code out in a PHP page, it gives me javascript errors. I am using the following to echo it out in PHP: echo A href=\javascript:go_where_my_variable_says('this.php');\this page/a SCRIPT LANGUAGE=\JavaScript\ !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT ; This displays the link fine for the submit hyperlink, but it gives the javascript error: Error: Object doesn't support this property or method. Code: 0 Like I said before, this code works perfectly fine if I have it an html document. Anyone got any ideas? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link acting as a submit button
[EMAIL PROTECTED] Ray Hunter: On Fri, 2003-07-25 at 05:30, Matt Palermo wrote: I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Yes it matters tons with the javascript call. Here is some info on it...however, these questions are now javascript and not php... That's only if you're going between frames, if the whole form (as usual) is on one frame it works fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Link acting as a submit button
Good point...thanks for catching that I usually link into forms from other frames if I dont have a submit button in that form. -- BigDog On Fri, 2003-07-25 at 15:49, Comex wrote: [EMAIL PROTECTED] Ray Hunter: On Fri, 2003-07-25 at 05:30, Matt Palermo wrote: I just remembered (I'm not sure if it makes a difference) that I am using frames on this page. Does this matter at all? Thanks. Yes it matters tons with the javascript call. Here is some info on it...however, these questions are now javascript and not php... That's only if you're going between frames, if the whole form (as usual) is on one frame it works fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Link acting as a submit button
Fixing the javascript that you specified still gave me the same errors... Got any more suggestions? Thanks for your help, Matt -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 6:40 PM To: Matt Palermo Subject: Re: [PHP] Link acting as a submit button Your javascript is wrong. change this document.forms[0].action = where; to this document.forms[0].action.value = where; Jim Lucas - Original Message - From: Matt Palermo [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 24, 2003 3:35 PM Subject: [PHP] Link acting as a submit button I am trying to create a submit button out of a hyperlink using the following code: (this is in a file called index.html) A href=javascript:go_where_my_variable_says('this.php');this page/a SCRIPT LANGUAGE=JavaScript !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT This works fine as an html document, however, when I try to echo the same code out in a PHP page, it gives me javascript errors. I am using the following to echo it out in PHP: echo A href=\javascript:go_where_my_variable_says('this.php');\this page/a SCRIPT LANGUAGE=\JavaScript\ !-- function go_where_my_variable_says(where) { document.forms[0].action = where; document.forms[0].submit(); } //-- /SCRIPT ; This displays the link fine for the submit hyperlink, but it gives the javascript error: Error: Object doesn't support this property or method. Code: 0 Like I said before, this code works perfectly fine if I have it an html document. Anyone got any ideas? Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Link acting as a submit button
|-Original Message- |From: Matt Palermo [EMAIL PROTECTED] |Sent: Thursday, July 24, 2003 3:35 PM | | I am trying to create a submit button out of a hyperlink using the | following | code: | | (this is in a file called index.html) | A DEFANGED_href=javascript:go_where_my_variable_says('this.php');this | page/a | | DEFANGED_SCRIPT LANGUAGE=JavaScript | !-- | function go_where_my_variable_says(where) | { | document.forms[0].action = where; | document.forms[0].submit(); | } | //-- | /DEFANGED_SCRIPT | This works fine as an html document, however, when I try to echo the | same code out in a PHP page, it gives me javascript errors. I am using | the following to echo it out in PHP: | | echo | A href=\javascript:go_where_my_variable_says('this.php');\this | page/a | | | DEFANGED_SCRIPT LANGUAGE=\JavaScript\ | !-- | function go_where_my_variable_says(where) | { | document.forms[0].action = where; | document.forms[0].submit(); | } | //-- | /DEFANGED_SCRIPT | ; | | This displays the link fine for the submit hyperlink, but it gives the | | javascript error: | | Error: Object doesn't support this property or method. | Code: 0 | Like I said before, this code works perfectly fine if I have it an html | document. | | Anyone got any ideas? | | Thanks, | Matt | |From: Jim Lucas [mailto:[EMAIL PROTECTED] |Sent: Thursday, July 24, 2003 6:40 PM |To: Matt Palermo |Subject: Re: [PHP] Link acting as a submit button | |Your javascript is wrong. | |change this |document.forms[0].action = where; |to this |document.forms[0].action.value = where; | |Jim Lucas | |- Original Message - On Jul 24, 2003, Matt Palermo claimed that: |Fixing the javascript that you specified still gave me the same |errors... Got any more suggestions? | |Thanks for your help, | |Matt When you converted it to PHP did you include the form tags? I received a similar error until I added the form tags. Other than that, try adding a name value to the form and change 'document.forms[0].action = where;' to 'document.form_name.action = where;' Except for the fact that I don't have this.php, it appeared to work for me after the addition of the form tags as posted. Jeff -- Registered Linux user #304026. lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php