Re: [WebDNA] Issue with variable inside a Function

This WebDNA talk-list message is from

2018


It keeps the original formatting.
numero = 114271
interpreted = N
texte = 1876 --000000000000247c6f056c951925 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Palle, Hi - within each loop your yes and no submit buttons - and the 'textboxcontent' inputs have the same ID. So jQuery is pulling the value from the first - i.e. the Yes input each time. If you use Firefox Developer Edition - https://www.mozilla.org/en-US/firefox/developer/ - then open 'inspector > network > xhr" - you can then see the ajax requests and parameters that are passed etc. - Tom =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Digital Revolutionaries 1st Floor, Castleriver House 14-15 Parliament Street Temple Bar,Dublin 2 Ireland ---------------------------------------------- [t]: + 353 1 4403907 [e]: [w]: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D On 18 May 2018 at 21:32, Palle Bo Nielsen wrote: > Hi Donovan > > Thanks for the explanation and opinion. > > In the mean time I have migrated from the WebDNA Ajax framework to the > JQuery Ajax framework - but with the same objective. > > Please note that the code is a dummy code and should eventually end up > being 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 > forum 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 compar= ed > to the 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 > the right return specified area is fixed. > > H > > > > INDEX.DNA > > > > > > > > > > > > > > [loop start=3D1&end=3D3&advance=3D1] > > >
> Area [index]:
> >
> >
> > > id=3D"[index]"> >
> > >
> > > id=3D"[index]"> >
> >
> > > [/loop] > > > > > > > > > > > PARSING.DNA > > > > > > > > > > > > [time]:[textcontent] > >
Test Values: [listvariables][index],[name],[value][/listvariables] > > > > > > > > > > > > On 3 May 2018, at 17.29, dbrooke@euca.us wrote: > > > > In programming, respectfully, setting a global constant is a ridiculous > 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 would an > age-old idea of constants be implemented this way? Why not start 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 "feature" 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] a= nd > [scope] contexts. ;-) > > > > ... because... unfortunately, WSC has never properly addressed the full > 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 > 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 Aj= ax > 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 variabl= e > but also show up in the dynamical Ajax output. > >>> > >>> Just need to keep the variable alive :) af the Function/Ajax JS. > >>> > >>> /Palle > >>> > >>> > >>> > >>> > >>> > >>>> On 3 May 2018, at 13.50, Stuart Tremain > 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> wrote: > >>>>> > >>>>> Need a nudge=E2=80=A6 > >>>>> > >>>>> Why is the variable not parsed to the function? In other 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. > >>>>> > >>>>> [text scope=3Dglobal]test_variable=3D44[/text][test_variable] > >>>>> [ajaxDBEntry] > >>>>> > >>>>> /Palle--------------------------------------------------------- > >>>>> 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?numero=3D55 > >>>>> Bug Reporting: support@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?numero=3D55 > >>>> Bug Reporting: support@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?numero=3D55 > >>> Bug Reporting: support@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?numero=3D55 > >> Bug Reporting: support@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?numero=3D55 > > Bug Reporting: support@webdna.us > > > --000000000000247c6f056c951925 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Palle,

Hi - within each loop your yes a= nd no submit buttons - and the 'textboxcontent' inputs have the sam= e ID.=C2=A0 So jQuery is pulling the value from the first - i.e. the Yes in= put each time.

If you use Firefox Developer Editio= n - https://ww= w.mozilla.org/en-US/firefox/developer/ - then open 'inspector > = network > xhr" - you can then see the ajax requests and parameters = that are passed etc.

- Tom




=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D
Digital Revolutionaries
1st Floor, Castleriver House
14-15 = Parliament Street
Temple Bar,Dublin 2
Ireland
--------------------= --------------------------
[t]: + 353 1 4403907
[e]: <mailto:tom@revolutionaries.= ie>
[w]: <http://www.revolutionaries.ie/>
=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

On 18 May 2018 at 21:32, Palle Bo Nielsen <powerpalle@powerpalle.dk> wrote:
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/jquery.min.js"></script>

<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>



--------------------------------------------------------- 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?numero=3D55 Bug Reporting: support@webdna.us --000000000000247c6f056c951925-- . Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Issue with variable inside a Function (Tom Duke 2018)
  2. Re: [WebDNA] Issue with variable inside a Function (Palle Bo Nielsen 2018)
  3. Re: [WebDNA] Issue with variable inside a Function (Stuart Tremain 2018)
  4. Re: [WebDNA] Issue with variable inside a Function (Palle Bo Nielsen 2018)
  5. Re: [WebDNA] Issue with variable inside a Function (dbrooke@euca.us 2018)
  6. Re: [WebDNA] Issue with variable inside a Function (christophe.billiottet@webdna.us 2018)
  7. Re: [WebDNA] Issue with variable inside a Function (Palle Bo Nielsen 2018)
  8. Re: [WebDNA] Issue with variable inside a Function (Stuart Tremain 2018)
  9. [WebDNA] Issue with variable inside a Function (Palle Bo Nielsen 2018)
1876 --000000000000247c6f056c951925 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Palle, Hi - within each loop your yes and no submit buttons - and the 'textboxcontent' inputs have the same ID. So jQuery is pulling the value from the first - i.e. the Yes input each time. If you use Firefox Developer Edition - https://www.mozilla.org/en-US/firefox/developer/ - then open 'inspector > network > xhr" - you can then see the ajax requests and parameters that are passed etc. - Tom =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Digital Revolutionaries 1st Floor, Castleriver House 14-15 Parliament Street Temple Bar,Dublin 2 Ireland ---------------------------------------------- [t]: + 353 1 4403907 [e]: [w]: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D On 18 May 2018 at 21:32, Palle Bo Nielsen wrote: > Hi Donovan > > Thanks for the explanation and opinion. > > In the mean time I have migrated from the WebDNA Ajax framework to the > JQuery Ajax framework - but with the same objective. > > Please note that the code is a dummy code and should eventually end up > being 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 > forum 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 compar= ed > to the 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 > the right return specified area is fixed. > > H > > > > INDEX.DNA > > > > > > > > > > > > > > [loop start=3D1&end=3D3&advance=3D1] > > >
> Area [index]:
> >
> >
> > > id=3D"[index]"> >
> > >
> > > id=3D"[index]"> >
> >
> > > [/loop] > > > > > > > > > > > PARSING.DNA > > > > > > > > > > > >
[time]:[textcontent] > >
Test Values: [listvariables][index],[name],[value][/listvariables] > > > > > > > > > > > > On 3 May 2018, at 17.29, dbrooke@euca.us wrote: > > > > In programming, respectfully, setting a global constant is a ridiculous > 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 would an > age-old idea of constants be implemented this way? Why not start 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 "feature" 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] a= nd > [scope] contexts. ;-) > > > > ... because... unfortunately, WSC has never properly addressed the full > 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 > 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 Aj= ax > 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 variabl= e > but also show up in the dynamical Ajax output. > >>> > >>> Just need to keep the variable alive :) af the Function/Ajax JS. > >>> > >>> /Palle > >>> > >>> > >>> > >>> > >>> > >>>> On 3 May 2018, at 13.50, Stuart Tremain > 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> wrote: > >>>>> > >>>>> Need a nudge=E2=80=A6 > >>>>> > >>>>> Why is the variable not parsed to the function? In other 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. > >>>>> > >>>>> [text scope=3Dglobal]test_variable=3D44[/text][test_variable] > >>>>> [ajaxDBEntry] > >>>>> > >>>>> /Palle--------------------------------------------------------- > >>>>> 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?numero=3D55 > >>>>> Bug Reporting: support@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?numero=3D55 > >>>> Bug Reporting: support@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?numero=3D55 > >>> Bug Reporting: support@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?numero=3D55 > >> Bug Reporting: support@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?numero=3D55 > > Bug Reporting: support@webdna.us > > > --000000000000247c6f056c951925 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Palle,

Hi - within each loop your yes a= nd no submit buttons - and the 'textboxcontent' inputs have the sam= e ID.=C2=A0 So jQuery is pulling the value from the first - i.e. the Yes in= put each time.

If you use Firefox Developer Editio= n - https://ww= w.mozilla.org/en-US/firefox/developer/ - then open 'inspector > = network > xhr" - you can then see the ajax requests and parameters = that are passed etc.

- Tom




=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D
Digital Revolutionaries
1st Floor, Castleriver House
14-15 = Parliament Street
Temple Bar,Dublin 2
Ireland
--------------------= --------------------------
[t]: + 353 1 4403907
[e]: <mailto:tom@revolutionaries.= ie>
[w]: <http://www.revolutionaries.ie/>
=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

On 18 May 2018 at 21:32, Palle Bo Nielsen <powerpalle@powerpalle.dk> wrote:
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/jquery.min.js"></script>

<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>



--------------------------------------------------------- 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?numero=3D55 Bug Reporting: support@webdna.us --000000000000247c6f056c951925-- . Tom Duke

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

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...

Related Readings:

Pithy questions on webcommerce & siteedit (1997) Replace context problem ... and answers (1997) list cookies and list http headers (1997) RE: Displaying Location (1997) pc (1997) [WebDNA] random blank results? how come? (2014) checking for [ and ] in form fields ... (1997) [append] problem (1997) Setting up shop (1997) japanese characters (1997) Authorize.net, SIM, tcpconnect and applescript (2003) WebCat cannot handle compatible search parameters? (1997) requiring form fields? (2000) Users and groups for local directories (1999) PCS Frames (1997) frames & carts (1997) Change Subtotal (2000) F3 crashing server (1997) Sending E-mail (1997) [CART] inside a [LOOP] (1997)