JavaScript regular expression mirrors Lasso tag

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

JavaScript regular expression mirrors Lasso tag

daleabrams
I am searching to see if there is a Lasso tag that essentially stops Lasso from processing a block of code. I have a JS RE that contains a Lasso-like string in it ( [...] ) and I'd like to stop Lasso from throwing errors. Please advise.


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: JavaScript regular expression mirrors Lasso tag

Gordon McLean
Hi
My lasso is very rusty but I think this works ...

[NoProcess]
   //some js code
[/NoProcess]


NoProcess;
   //some js code
/NoProcess;

cheers
Gordon


On 28 November 2012 20:43, <[hidden email]> wrote:

> I am searching to see if there is a Lasso tag that essentially stops Lasso
> from processing a block of code. I have a JS RE that contains a Lasso-like
> string in it ( [...] ) and I'd like to stop Lasso from throwing errors.
> Please advise.
>
>
> #############################################################
> This message is sent to you because you are subscribed to
>   the mailing list Lasso
> [hidden email]
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
>



--
ATB
Gordon McLean

O: 0203 239 3638
M: 07725432287
E: [hidden email]
S: clickworksafe
#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: JavaScript regular expression mirrors Lasso tag

Wade Maxfield
In reply to this post by daleabrams
On 29/11/2012, at 9:43 AM, [hidden email] wrote:

> I am searching to see if there is a Lasso tag that essentially stops Lasso from processing a block of code. I have a JS RE that contains a Lasso-like string in it ( [...] ) and I'd like to stop Lasso from throwing errors. Please advise.

[NoProcess]

http://www.lassosoft.com/LassoDocs/languageReference/obj/NoProcess

 - Wade


#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

RE: JavaScript regular expression mirrors Lasso tag

Rick Draper-2
In reply to this post by daleabrams
Hi Dale,

Which version of Lasso?

In Lasso 9 we use the following at the top of every page..

[no_square_brackets] // note that ironically this needs to be in square brackets

if you want to include Lasso processed material surround it with "<?= yourcode ?>" and it works just like square bracket syntax.

Very best regards,

Rick




#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: JavaScript regular expression mirrors Lasso tag

Brad Lindsay-2
In reply to this post by daleabrams

On Nov 28, 2012, at 3:43 PM, [hidden email] wrote:

> I am searching to see if there is a Lasso tag that essentially stops Lasso from processing a block of code. I have a JS RE that contains a Lasso-like string in it ( [...] ) and I'd like to stop Lasso from throwing errors. Please advise.

1) I recommend putting your JavaScript in a separate file that gets loaded in via <script src="...">

2) If not possible or desirable, then here is what I do to get around stuff like that in my HTML:

<script type="text/javascript">
//<!--
    ... My Java Script Here ...
//-->
</script>


Lasso will ignore anything in the HTML comment and not try to parse your JavaScript code. By using a JavaScript comment, JavaScript will ignore the HTML comment markers. Everyone wins


Brad
#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: JavaScript regular expression mirrors Lasso tag

French, Shelane
There are times I need lasso to process something in my javascript, but
there are times I don't. I put a [NoProcess] block around the javascript
parts that have brackets to keep lasso from processing that.

Here's a code snippet where I block Lasso and where I use lasso in my
javascript:

...
[NoProcess]
function formatResult(row) {
        return row[1];
}
function formatItem(row) {
        return ('<span class="pull-left">&nbsp;' + row[0] + '</span> <span
class="pull-right">'  + row[1] + '&nbsp;</span>');
}[/NoProcess]

$('#champion').autocomplete("playbook.lasso?route=users&task=list&who=[$org
]", {minChars: 2, delay: 150, formatResult: formatResult, formatItem:
formatItem, max: 2000, width: 300, scroll: false, cacheLength: 1,
mustMatch: true});
...


On 11/30/12 5:38 AM, "Brad Lindsay" <[hidden email]> wrote:

>
>On Nov 28, 2012, at 3:43 PM, [hidden email] wrote:
>
>> I am searching to see if there is a Lasso tag that essentially stops
>>Lasso from processing a block of code. I have a JS RE that contains a
>>Lasso-like string in it ( [...] ) and I'd like to stop Lasso from
>>throwing errors. Please advise.
>
>1) I recommend putting your JavaScript in a separate file that gets
>loaded in via <script src="...">
>
>2) If not possible or desirable, then here is what I do to get around
>stuff like that in my HTML:
>
><script type="text/javascript">
>//<!--
>    ... My Java Script Here ...
>//-->
></script>
>
>
>Lasso will ignore anything in the HTML comment and not try to parse your
>JavaScript code. By using a JavaScript comment, JavaScript will ignore
>the HTML comment markers. Everyone wins
>
>
>Brad
>#############################################################
>This message is sent to you because you are subscribed to
>  the mailing list Lasso
>[hidden email]
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: JavaScript regular expression mirrors Lasso tag

Brad Lindsay-2

On Nov 30, 2012, at 11:11 AM, "French, Shelane" <[hidden email]> wrote:

> There are times I need lasso to process something in my javascript, but
> there are times I don't. I put a [NoProcess] block around the javascript
> parts that have brackets to keep lasso from processing that.
>
> Here's a code snippet where I block Lasso and where I use lasso in my
> javascript:
>
> ...
> [NoProcess]
> function formatResult(row) {
> return row[1];
> }
> function formatItem(row) {
> return ('<span class="pull-left">&nbsp;' + row[0] + '</span> <span
> class="pull-right">'  + row[1] + '&nbsp;</span>');
> }[/NoProcess]
>
> $('#champion').autocomplete("playbook.lasso?route=users&task=list&who=[$org
> ]", {minChars: 2, delay: 150, formatResult: formatResult, formatItem:
> formatItem, max: 2000, width: 300, scroll: false, cacheLength: 1,
> mustMatch: true});
> ...

I find it better to declare JavaScript variables with the needed Lasso data up front and then use those variables in the code.

Ex.
<script type="text/javascript">
    var EVENT_ID = [#event_id];
//<!--
    function updateOtherRegistrations() {
        var result = $.post('/registrations/update', {event_id: EVENT_ID}, 'json');
    }
//-->
</script>

This way the only JavaScript code not protected is setting up the variables. I feel safer that way :)

Brad
#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>