|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)Hi there,
I am doing an application that allows me to create RSS channels and put feeds inside of each channel. Everything works so far, but - now I have started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and 'Delete Feed' functionalities and have run into a problem. For me its a big problem cause Im not a guru programmer but for you out there it may be a piece of cake. I have the following line of code: $myFeedHTML .= "<TH ROWSPAN=3 BGCOLOR='#99CCFF'> In $myFeedHTML I'am always appending new HTML data to it, in this case I'am appending a table row/header row that has an image in it and underneath the image it has two buttons, one is for the EDIT functionality and the other is for the DELETE functionality. Now... notice the onClik events -> onClik='javascript:DeleteChannelAndAllOfItsFeeds()' . I ususally use that method to call a javascript function from within a button or a link....and like this is works (on its own - ie when its not being appended as a normal string to the variable $myFeedHTML). But...When it is appended to a variable so that I echo everything at once in the end, the onClik action must be included inside a " (double quotes) and inside ' (single quotes) so that it can be appeneded to the string, now when this is being done everything gets mixed because of of all the " and ' thus the program thinks that these are normal escape characters and just skips over the javascript call function that is nested within the onClik event. So the onClik is not getting a function assigned to it. (you can see this in the code I've pasted above) What can I do in order to append it to my $myFeedHTML variable and at the same time have it assigend a javascript function inside of its EDIT/DELETE button onClik event ? Can you give me some example maybe etc ? Image Preview: ![]() btw: I know I've written onClik wrong but I wrote it this way in this forum cause it wouldn't let me post my thread because it regards it as an illegal tag lol. ![]() ![]() Thank you very much :) , The Ace |
|
|
Re: PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)Hey,
You can do it this way as well $myFeedHTML .= "<TH ROWSPAN=3 BGCOLOR='#99CCFF'> $feedItemImagePath <br /> <br /> <input type='Button' value='Edit' width='100px' onClik=\"javascript: > > DeleteChannelAndAllOfItsFeeds()\" /> <br /> <br > />DELETE<br /></TH>"; So you can escape double quotes by \ (slash) try this .. It will work... you can escape any special character that you want to use as it is by prepend it by \ On Mon, Nov 2, 2009 at 2:23 PM, acetrader <salibaray@...> wrote: > > Hi there, > > I am doing an application that allows me to create RSS channels and put > feeds inside of each channel. Everything works so far, but - now I have > started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and 'Delete > Feed' functionalities and have run into a problem. For me its a big problem > cause Im not a guru programmer but for you out there it may be a piece of > cake. > > I have the following line of code: > > $myFeedHTML .= "<TH ROWSPAN=3 BGCOLOR='#99CCFF'> $feedItemImagePath <br /> > <br /> <input type='Button' value='Edit' width='100px' > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' /> <br /> <br > />DELETE<br /></TH>"; > > In $myFeedHTML I'am always appending new HTML data to it, in this case I'am > appending a table row/header row that has an image in it and underneath the > image it has two buttons, one is for the EDIT functionality and the other > is > for the DELETE functionality. > > Now... notice the onClik events -> > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' . I ususally use > that > method to call a javascript function from within a button or a link....and > like this is works (on its own - ie when its not being appended as a normal > string to the variable $myFeedHTML). > > But...When it is appended to a variable so that I echo everything at once > in > the end, the onClik action must be included inside a " (double quotes) and > inside ' (single quotes) so that it can be appeneded to the string, now > when this is being done everything gets mixed because of of all the " and ' > thus the program thinks that these are normal escape characters and just > skips over the javascript call function that is nested within the onClik > event. So the onClik is not getting a function assigned to it. (you can see > this in the code I've pasted above) > > What can I do in order to append it to my $myFeedHTML variable and at the > same time have it assigend a javascript function inside of its EDIT/DELETE > button onClik event ? > > Can you give me some example maybe etc ? > > Image Preview: > > http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg > > btw: I know I've written onClik wrong but I wrote it this way in this forum > cause it wouldn't let me post my thread because it regards it as an illegal > tag lol. B-)B-) > > Thank you very much :) , > The Ace > > > -- > View this message in context: > http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.html > Sent from the PHP - General mailing list archive at Nabble.com. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Devendra Jadhav |
|
|
Re: PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)On Mon, 2009-11-02 at 00:53 -0800, acetrader wrote:
> Hi there, > > I am doing an application that allows me to create RSS channels and put > feeds inside of each channel. Everything works so far, but - now I have > started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and 'Delete > Feed' functionalities and have run into a problem. For me its a big problem > cause Im not a guru programmer but for you out there it may be a piece of > cake. > > I have the following line of code: > > $myFeedHTML .= "<TH ROWSPAN=3 BGCOLOR='#99CCFF'> $feedItemImagePath <br /> > <br /> <input type='Button' value='Edit' width='100px' > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' /> <br /> <br > />DELETE<br /></TH>"; > > In $myFeedHTML I'am always appending new HTML data to it, in this case I'am > appending a table row/header row that has an image in it and underneath the > image it has two buttons, one is for the EDIT functionality and the other is > for the DELETE functionality. > > Now... notice the onClik events -> > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' . I ususally use that > method to call a javascript function from within a button or a link....and > like this is works (on its own - ie when its not being appended as a normal > string to the variable $myFeedHTML). > > But...When it is appended to a variable so that I echo everything at once in > the end, the onClik action must be included inside a " (double quotes) and > inside ' (single quotes) so that it can be appeneded to the string, now > when this is being done everything gets mixed because of of all the " and ' > thus the program thinks that these are normal escape characters and just > skips over the javascript call function that is nested within the onClik > event. So the onClik is not getting a function assigned to it. (you can see > this in the code I've pasted above) > > What can I do in order to append it to my $myFeedHTML variable and at the > same time have it assigend a javascript function inside of its EDIT/DELETE > button onClik event ? > > Can you give me some example maybe etc ? > > Image Preview: > > http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg > > btw: I know I've written onClik wrong but I wrote it this way in this forum > cause it wouldn't let me post my thread because it regards it as an illegal > tag lol. B-)B-) > > Thank you very much :) , > The Ace > > > -- > View this message in context: http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.html > Sent from the PHP - General mailing list archive at Nabble.com. > > I've noticed also that in your code you've always referred to onclik, when it should be onclick. I hope this was just a typo in the email! Thanks, Ash http://www.ashleysheridan.co.uk |
|
|
Re: PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)2009/11/2 Ashley Sheridan <ash@...>:
> On Mon, 2009-11-02 at 00:53 -0800, acetrader wrote: > >> Hi there, >> >> I am doing an application that allows me to create RSS channels and put >> feeds inside of each channel. Everything works so far, but - now I have >> started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and 'Delete >> Feed' functionalities and have run into a problem. For me its a big problem >> cause Im not a guru programmer but for you out there it may be a piece of >> cake. >> >> I have the following line of code: >> >> $myFeedHTML .= "<TH ROWSPAN=3 BGCOLOR='#99CCFF'> $feedItemImagePath <br /> >> <br /> <input type='Button' value='Edit' width='100px' >> onClik='javascript:DeleteChannelAndAllOfItsFeeds()' /> <br /> <br >> />DELETE<br /></TH>"; >> >> In $myFeedHTML I'am always appending new HTML data to it, in this case I'am >> appending a table row/header row that has an image in it and underneath the >> image it has two buttons, one is for the EDIT functionality and the other is >> for the DELETE functionality. >> >> Now... notice the onClik events -> >> onClik='javascript:DeleteChannelAndAllOfItsFeeds()' . I ususally use that >> method to call a javascript function from within a button or a link....and >> like this is works (on its own - ie when its not being appended as a normal >> string to the variable $myFeedHTML). >> >> But...When it is appended to a variable so that I echo everything at once in >> the end, the onClik action must be included inside a " (double quotes) and >> inside ' (single quotes) so that it can be appeneded to the string, now >> when this is being done everything gets mixed because of of all the " and ' >> thus the program thinks that these are normal escape characters and just >> skips over the javascript call function that is nested within the onClik >> event. So the onClik is not getting a function assigned to it. (you can see >> this in the code I've pasted above) >> >> What can I do in order to append it to my $myFeedHTML variable and at the >> same time have it assigend a javascript function inside of its EDIT/DELETE >> button onClik event ? >> >> Can you give me some example maybe etc ? >> >> Image Preview: >> >> http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg >> >> btw: I know I've written onClik wrong but I wrote it this way in this forum >> cause it wouldn't let me post my thread because it regards it as an illegal >> tag lol. B-)B-) >> >> Thank you very much :) , >> The Ace >> >> >> -- >> View this message in context: http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.html >> Sent from the PHP - General mailing list archive at Nabble.com. >> >> > > > I've noticed also that in your code you've always referred to onclik, > when it should be onclick. I hope this was just a typo in the email! I've noticed also that you didn't read his email properly. I hope that was just an oversight. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
|
Re: PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)Ashley Sheridan:
> btw: I know I've written onClik wrong but I wrote it this way in this forum > cause it wouldn't let me post my thread because it regards it as an illegal > tag lol. B-)B-) :D On Mon, Nov 2, 2009 at 4:38 PM, Ashley Sheridan <ash@...>wrote: > On Mon, 2009-11-02 at 00:53 -0800, acetrader wrote: > > > Hi there, > > > > I am doing an application that allows me to create RSS channels and put > > feeds inside of each channel. Everything works so far, but - now I have > > started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and > 'Delete > > Feed' functionalities and have run into a problem. For me its a big > problem > > cause Im not a guru programmer but for you out there it may be a piece of > > cake. > > > > I have the following line of code: > > > > $myFeedHTML .= "<TH ROWSPAN=3 BGCOLOR='#99CCFF'> > $feedItemImagePath <br /> > > <br /> <input type='Button' value='Edit' width='100px' > > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' /> <br /> <br > > />DELETE<br /></TH>"; > > > > In $myFeedHTML I'am always appending new HTML data to it, in this case > I'am > > appending a table row/header row that has an image in it and underneath > the > > image it has two buttons, one is for the EDIT functionality and the other > is > > for the DELETE functionality. > > > > Now... notice the onClik events -> > > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' . I ususally use > that > > method to call a javascript function from within a button or a > link....and > > like this is works (on its own - ie when its not being appended as a > normal > > string to the variable $myFeedHTML). > > > > But...When it is appended to a variable so that I echo everything at once > in > > the end, the onClik action must be included inside a " (double quotes) > and > > inside ' (single quotes) so that it can be appeneded to the string, now > > when this is being done everything gets mixed because of of all the " and > ' > > thus the program thinks that these are normal escape characters and just > > skips over the javascript call function that is nested within the onClik > > event. So the onClik is not getting a function assigned to it. (you can > see > > this in the code I've pasted above) > > > > What can I do in order to append it to my $myFeedHTML variable and at the > > same time have it assigend a javascript function inside of its > EDIT/DELETE > > button onClik event ? > > > > Can you give me some example maybe etc ? > > > > Image Preview: > > > > http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg > > > > btw: I know I've written onClik wrong but I wrote it this way in this > forum > > cause it wouldn't let me post my thread because it regards it as an > illegal > > tag lol. B-)B-) > > > > Thank you very much :) , > > The Ace > > > > > > -- > > View this message in context: > http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.html > > Sent from the PHP - General mailing list archive at Nabble.com. > > > > > > > I've noticed also that in your code you've always referred to onclik, > when it should be onclick. I hope this was just a typo in the email! > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > > -- Devendra Jadhav |
|
|
Re: PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)On Mon, 2009-11-02 at 16:51 +0530, Devendra Jadhav wrote:
> Ashley Sheridan: > > btw: I know I've written onClik wrong but I wrote it this way in this > forum > > cause it wouldn't let me post my thread because it regards it as an > illegal > > tag lol. B-)B-) > > :D > > > On Mon, Nov 2, 2009 at 4:38 PM, Ashley Sheridan <ash@...>wrote: > > > On Mon, 2009-11-02 at 00:53 -0800, acetrader wrote: > > > > > Hi there, > > > > > > I am doing an application that allows me to create RSS channels and put > > > feeds inside of each channel. Everything works so far, but - now I have > > > started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and > > 'Delete > > > Feed' functionalities and have run into a problem. For me its a big > > problem > > > cause Im not a guru programmer but for you out there it may be a piece of > > > cake. > > > > > > I have the following line of code: > > > > > > $myFeedHTML .= "<TH ROWSPAN=3 BGCOLOR='#99CCFF'> > > $feedItemImagePath <br /> > > > <br /> <input type='Button' value='Edit' width='100px' > > > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' /> <br /> <br > > > />DELETE<br /></TH>"; > > > > > > In $myFeedHTML I'am always appending new HTML data to it, in this case > > I'am > > > appending a table row/header row that has an image in it and underneath > > the > > > image it has two buttons, one is for the EDIT functionality and the other > > is > > > for the DELETE functionality. > > > > > > Now... notice the onClik events -> > > > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' . I ususally use > > that > > > method to call a javascript function from within a button or a > > link....and > > > like this is works (on its own - ie when its not being appended as a > > normal > > > string to the variable $myFeedHTML). > > > > > > But...When it is appended to a variable so that I echo everything at once > > in > > > the end, the onClik action must be included inside a " (double quotes) > > and > > > inside ' (single quotes) so that it can be appeneded to the string, now > > > when this is being done everything gets mixed because of of all the " and > > ' > > > thus the program thinks that these are normal escape characters and just > > > skips over the javascript call function that is nested within the onClik > > > event. So the onClik is not getting a function assigned to it. (you can > > see > > > this in the code I've pasted above) > > > > > > What can I do in order to append it to my $myFeedHTML variable and at the > > > same time have it assigend a javascript function inside of its > > EDIT/DELETE > > > button onClik event ? > > > > > > Can you give me some example maybe etc ? > > > > > > Image Preview: > > > > > > http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg > > > > > > btw: I know I've written onClik wrong but I wrote it this way in this > > forum > > > cause it wouldn't let me post my thread because it regards it as an > > illegal > > > tag lol. B-)B-) > > > > > > Thank you very much :) , > > > The Ace > > > > > > > > > -- > > > View this message in context: > > http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.html > > > Sent from the PHP - General mailing list archive at Nabble.com. > > > > > > > > > > > > I've noticed also that in your code you've always referred to onclik, > > when it should be onclick. I hope this was just a typo in the email! > > > > Thanks, > > Ash > > http://www.ashleysheridan.co.uk > > > > > > > > oops, lol! Thanks, Ash http://www.ashleysheridan.co.uk |
|
|
Re: PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)lol thank you very much guys :) the escape character worked and now its accepting my javascript functions, thank you all very much :)
![]() ![]() |
|
|
Re: PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;):)
On Mon, Nov 2, 2009 at 4:56 PM, acetrader <salibaray@...> wrote: > > lol thank you very much guys :) the escape character worked and now its > accepting my javascript functions, thank you all very much :) > :jumping::jumping: > -- > View this message in context: > http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156680.html > Sent from the PHP - General mailing list archive at Nabble.com. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Devendra Jadhav |
| Free embeddable forum powered by Nabble | Forum Help |