Hi Donovan
Thanks for the explanation and opinion.
In the mean time I have migrated from the WebDNA Ajax framework to the JQue=ry Ajax framework - but with the same objective.
Please note that the code is a dummy code and should eventually end up bein=g use as a Like or Dislike in a forum (forum post function).
The code which I am pasting within the mail is supposed to illustrate a for=um thread with three posts. Each of them can be rate with a yes or no (like= or dislike). New new code has given me some other challenges compared to t=he previous.
a) regardless of me pressing yes or no it returns the value =E2=80=9C1=E2==80=9D even though the forum input should have dictated another value =E2==80=9C2=E2=80=9D when pressing 2.
b) any form variable is not forwarded to the parson.dna file which I do not= understand.
So my original problem of returning a value form AJAX to the HTML within th=e right return specified area is fixed.
H<er come the code (also attached).
INDEX.DNA
<!--HAS_WEBDNA_TAGS-->
<html>
<head>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <script src=3D"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/ "></script>jquery.min.js
<script type=3D"text/javascript" >
$(document).ready(function()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 $(".vote_submit").click(function=(){
=C2=A0 =C2=A0 =C2=A0 =C2=A0 var element =3D $(this);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 var Id =3D element.attr("id");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 var test =3D $("#textboxcontent"+Id).=val();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 var dataString =3D 'textcontent=3D'+ te=st + '&com_msgid=3D' + Id;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 $.ajax({
=C2=A0 =C2=A0 =C2=A0 =C2=A0 type: "POST",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 url: "proces.dna",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 data: dataString,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cache: false,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 success: function(html){
=C2=A0 =C2=A0 =C2=A0 =C2=A0 $("#loadplace"+Id).append(html);=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
});
}return false;});});
</script>
</head>
<body>
[loop start=3D1&end=3D3&advance=3D1]
<div style=3D"border: 1px solid black;">
<b>Area [index]:</b><br>
<div id=3D"loadplace[index]"></div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <form action=3D"" method=3D"p=ost" name=3D"[index]">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <input id=3D&quo=t;textboxcontent[index]" type=3D"hidden" value=3D"1&quo=t;>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <input name=3D&q=uot;abc" type=3D"hidden" value=3D"1">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <input type=3D&q=uot;submit" value=3D"Yes" class=3D"vote_submit" id==3D"[index]">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </form>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <form action=3D"" method=3D"p=ost" name=3D"[index]">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <input id=3D&quo=t;textboxcontent[index]" type=3D"hidden" value=3D"2&quo=t;>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <input name=3D&q=uot;abc" type=3D"hidden" value=3D"2">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <input type=3D&q=uot;submit" value=3D"No" class=3D"vote_submit" id==3D"[index]">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </form>
</div>
[/loop]
</body>
</html>
PARSING.DNA
<!--HAS_WEBDNA_TAGS-->
<!DOCTYPE html>
<html>
<head>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <title></title>
</head>
<body>
[time]:[textcontent]
<br>Test Values: [listvariables][index],[name],[value][/listvari=ables]
</body>
</html>
> On 3 May 2018, at 17.29, dbrooke@eu=ca.us wrote:
>
> In programming, respectfully, setting a global constant is a ridiculou=s thing to do in this situation.
>
> Constants, especially global constants, are for server-wide vars that =don't change much. I would hate to see WSC recommending their users
> set temporary, permanent, and server-wide variables on a regular basis=..
>
> Though I think the idea of '[Store]' has some potential, why w=ould an age-old idea of constants be implemented this way?=C2=A0 Why not st=art with a standard... something like PHP's define.
> [define blah=3Dblah] or
> [define scope=3Dglobal blah=3Dblah]
>
> Then it's a variable that can't change..
> [blah]
> [:named-global:blah]
>
> Constants are relatively easily set anyway and this entire "featu=re" is really easy to create without a [store] or [define].
>
> Anyway, back to the issue...
> Palle, I think you'd have to post some code.
>
> One of the best things about WebDNA is it's [function] and [scope]= contexts... and one of the worst things about WebDNA is it's [function=] and [scope] contexts. ;-)
>
> ... because... unfortunately, WSC has never properly addressed the ful=l documentation, nor the improvements to these contexts... but if you post =your code, some of us may be able to help.
>
> Yours Truly,
> Debby Downer
>
>
>
>
>
>
>
>
>
> On 2018-05-03 07:44, christophe.billiottet@webdna.us wrote:
>> Palle, you could use [store]
>>
>> - chris
>>
>>> On May 3, 2018, at 15:37, Palle Bo Nielsen <powerpalle@powerpalle.dk> wrote:
>>>
>>> Thanks (it works), but how can I make the variable continue to= work. In this case the Variable has been brought into the Function (which =is Ajax JS) but then the variable seems to stop to exist afterwards. And in= this particular case the next fase is to do some Append off the actual var=iable but also show up in the dynamical Ajax output.
>>>
>>> Just need to keep the variable alive :) af the Function/Ajax J=S.
>>>
>>> /Palle
>>>
>>>
>>>
>>>
>>>
>>>> On 3 May 2018, at 13.50, Stuart Tremain <webdna@plsoftware.com.au> wrote:
>>>>
>>>> [ajaxDBentry test_variable=3D44]
>>>>
>>>> Regards
>>>> Stuart Tremain
>>>>
>>>> Pharoah Lane Software
>>>> 7/76 Reserve Road
>>>> Artarmon NSW 2064
>>>> AUSTRALIA
>>>> +612 8971 4431
>>>>
>>>>> On 3 May 2018, at 9:29 pm, Palle Bo Nielsen <powerpalle@powerpalle.dk> wrot=e:
>>>>>
>>>>> Need a nudge=E2=80=A6
>>>>>
>>>>> Why is the variable not parsed to the function? In oth=er words; I can se the value of =E2=80=9Ctest_variable=E2=80=9D if I expose= it before I call the Function but not after the Function has been called.<=br>>>>>>
>>>>> [text scope=3Dglobal]test_variable=3D44[/text][te=st_variable]
>>>>> [ajaxDBEntry]
>>>>>
>>>>> /Palle-------------------------------------------=----------- ---
>>>>> This message is sent to you because you are subscribed= to
>>>>> the mailing list tal=k@webdna.us
>>>>> To unsubscribe, E-mail to: talk-leave@webdna.us
>>>>> archives: http://www.webdna.us/page.dn=a?numero=3D55
>>>>> Bug Reporting: su=pport@webdna.us
>>>> -----------------------------------------------------=----
>>>> This message is sent to you because you are subscribed to<=br>>>>> the mailing list talk@we=bdna.us
>>>> To unsubscribe, E-mail to: talk-leave@webdna.us
>>>> archives: http://www.webdna.us/page.dna?<=wbr>numero=3D55
>>>> Bug Reporting: suppor=t@webdna.us
>>>
>>> ---------------------------------------------------------=
>>> This message is sent to you because you are subscribed to
>>> the mailing list talk@webdna=..us
>>> To unsubscribe, E-mail to: talk-leave@webdna.us
>>> archives: http://www.webdna.us/page.dna?n=umero=3D55
>>> Bug Reporting: support@we=bdna.us
>>
>> ---------------------------------------------------------
>> This message is sent to you because you are subscribed to
>> the mailing list talk@webdna.us<=/a>
>> To unsubscribe, E-mail to: talk-leave@webdna.us
>> archives: http://www.webdna.us/page.dna?numer=o=3D55
>> Bug Reporting: support@webdna=..us
>
> ---------------------------------------------------------
> This message is sent to you because you are subscribed to
> the mailing list talk@webdna.us<=br>> To unsubscribe, E-mail to: tal=k-leave@webdna.us
> archives: http://www.webdna.us/page.dna?numero=3D=55
> Bug Reporting: support@webdna.us<=/a>
|
Hi Donovan
Thanks for the explanation and opinion.
In the mean time I have migrated from the WebDNA Ajax framework to the JQue=ry Ajax framework - but with the same objective.
Please note that the code is a dummy code and should eventually end up bein=g use as a Like or Dislike in a forum (forum post function).
The code which I am pasting within the mail is supposed to illustrate a for=um thread with three posts. Each of them can be rate with a yes or no (like= or dislike). New new code has given me some other challenges compared to t=he previous.
a) regardless of me pressing yes or no it returns the value =E2=80=9C1=E2==80=9D even though the forum input should have dictated another value =E2==80=9C2=E2=80=9D when pressing 2.
b) any form variable is not forwarded to the parson.dna file which I do not= understand.
So my original problem of returning a value form AJAX to the HTML within th=e right return specified area is fixed.
H<er come the code (also attached).
INDEX.DNA
<!--HAS_WEBDNA_TAGS-->
<html>
<head>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <script src=3D"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/ "></script>jquery.min.js
<script type=3D"text/javascript" >
$(document).ready(function()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 $(".vote_submit").click(function=(){
=C2=A0 =C2=A0 =C2=A0 =C2=A0 var element =3D $(this);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 var Id =3D element.attr("id");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 var test =3D $("#textboxcontent"+Id).=val();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 var dataString =3D 'textcontent=3D'+ te=st + '&com_msgid=3D' + Id;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 $.ajax({
=C2=A0 =C2=A0 =C2=A0 =C2=A0 type: "POST",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 url: "proces.dna",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 data: dataString,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cache: false,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 success: function(html){
=C2=A0 =C2=A0 =C2=A0 =C2=A0 $("#loadplace"+Id).append(html);=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
});
}return false;});});
</script>
</head>
<body>
[loop start=3D1&end=3D3&advance=3D1]
<div style=3D"border: 1px solid black;">
<b>Area [index]:</b><br>
<div id=3D"loadplace[index]"></div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <form action=3D"" method=3D"p=ost" name=3D"[index]">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <input id=3D&quo=t;textboxcontent[index]" type=3D"hidden" value=3D"1&quo=t;>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <input name=3D&q=uot;abc" type=3D"hidden" value=3D"1">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <input type=3D&q=uot;submit" value=3D"Yes" class=3D"vote_submit" id==3D"[index]">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </form>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <form action=3D"" method=3D"p=ost" name=3D"[index]">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <input id=3D&quo=t;textboxcontent[index]" type=3D"hidden" value=3D"2&quo=t;>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <input name=3D&q=uot;abc" type=3D"hidden" value=3D"2">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <input type=3D&q=uot;submit" value=3D"No" class=3D"vote_submit" id==3D"[index]">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </form>
</div>
[/loop]
</body>
</html>
PARSING.DNA
<!--HAS_WEBDNA_TAGS-->
<!DOCTYPE html>
<html>
<head>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <title></title>
</head>
<body>
[time]:[textcontent]
<br>Test Values: [listvariables][index],[name],[value][/listvari=ables]
</body>
</html>
> On 3 May 2018, at 17.29, dbrooke@eu=ca.us wrote:
>
> In programming, respectfully, setting a global constant is a ridiculou=s thing to do in this situation.
>
> Constants, especially global constants, are for server-wide vars that =don't change much. I would hate to see WSC recommending their users
> set temporary, permanent, and server-wide variables on a regular basis=..
>
> Though I think the idea of '[store]' has some potential, why w=ould an age-old idea of constants be implemented this way?=C2=A0 Why not st=art with a standard... something like PHP's define.
> [define blah=3Dblah] or
> [define scope=3Dglobal blah=3Dblah]
>
> Then it's a variable that can't change..
> [blah]
> [:named-global:blah]
>
> Constants are relatively easily set anyway and this entire "featu=re" is really easy to create without a [store] or [define].
>
> Anyway, back to the issue...
> Palle, I think you'd have to post some code.
>
> One of the best things about WebDNA is it's [function] and [scope]= contexts... and one of the worst things about WebDNA is it's [function=] and [scope] contexts. ;-)
>
> ... because... unfortunately, WSC has never properly addressed the ful=l documentation, nor the improvements to these contexts... but if you post =your code, some of us may be able to help.
>
> Yours Truly,
> Debby Downer
>
>
>
>
>
>
>
>
>
> On 2018-05-03 07:44, christophe.billiottet@webdna.us wrote:
>> Palle, you could use [store]
>>
>> - chris
>>
>>> On May 3, 2018, at 15:37, Palle Bo Nielsen <powerpalle@powerpalle.dk> wrote:
>>>
>>> Thanks (it works), but how can I make the variable continue to= work. In this case the Variable has been brought into the Function (which =is Ajax JS) but then the variable seems to stop to exist afterwards. And in= this particular case the next fase is to do some Append off the actual var=iable but also show up in the dynamical Ajax output.
>>>
>>> Just need to keep the variable alive :) af the Function/Ajax J=S.
>>>
>>> /Palle
>>>
>>>
>>>
>>>
>>>
>>>> On 3 May 2018, at 13.50, Stuart Tremain <webdna@plsoftware.com.au> wrote:
>>>>
>>>> [ajaxDBentry test_variable=3D44]
>>>>
>>>> Regards
>>>> Stuart Tremain
>>>>
>>>> Pharoah Lane Software
>>>> 7/76 Reserve Road
>>>> Artarmon NSW 2064
>>>> AUSTRALIA
>>>> +612 8971 4431
>>>>
>>>>> On 3 May 2018, at 9:29 pm, Palle Bo Nielsen <powerpalle@powerpalle.dk> wrot=e:
>>>>>
>>>>> Need a nudge=E2=80=A6
>>>>>
>>>>> Why is the variable not parsed to the function? In oth=er words; I can se the value of =E2=80=9Ctest_variable=E2=80=9D if I expose= it before I call the Function but not after the Function has been called.<=br>>>>>>
>>>>> [text scope=3Dglobal]test_variable=3D44[/text][te=st_variable]
>>>>> [ajaxDBEntry]
>>>>>
>>>>> /Palle-------------------------------------------=----------- ---
>>>>> This message is sent to you because you are subscribed= to
>>>>> the mailing list tal=k@webdna.us
>>>>> To unsubscribe, E-mail to: talk-leave@webdna.us
>>>>> archives: http://www.webdna.us/page.dn=a?numero=3D55
>>>>> Bug Reporting: su=pport@webdna.us
>>>> -----------------------------------------------------=----
>>>> This message is sent to you because you are subscribed to<=br>>>>> the mailing list talk@we=bdna.us
>>>> To unsubscribe, E-mail to: talk-leave@webdna.us
>>>> archives: http://www.webdna.us/page.dna?<=wbr>numero=3D55
>>>> Bug Reporting: suppor=t@webdna.us
>>>
>>> ---------------------------------------------------------=
>>> This message is sent to you because you are subscribed to
>>> the mailing list talk@webdna=..us
>>> To unsubscribe, E-mail to: talk-leave@webdna.us
>>> archives: http://www.webdna.us/page.dna?n=umero=3D55
>>> Bug Reporting: support@we=bdna.us
>>
>> ---------------------------------------------------------
>> This message is sent to you because you are subscribed to
>> the mailing list talk@webdna.us<=/a>
>> To unsubscribe, E-mail to: talk-leave@webdna.us
>> archives: http://www.webdna.us/page.dna?numer=o=3D55
>> Bug Reporting: support@webdna=..us
>
> ---------------------------------------------------------
> This message is sent to you because you are subscribed to
> the mailing list talk@webdna.us<=br>> To unsubscribe, E-mail to: tal=k-leave@webdna.us
> archives: http://www.webdna.us/page.dna?numero=3D=55
> Bug Reporting: support@webdna.us<=/a>
DOWNLOAD WEBDNA NOW!
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...