Pass Javascript value to another lasso page

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

Pass Javascript value to another lasso page

GraemeG
Hello,

I have a Javascript value that I want to pass via a lasso form to another lasso page where it is then passed on to a php page using an Include_URL along with other values from the form. It works fine for all the values except the javascript value  An extract of the form is below and I think the value is created by return getTotal(this);

<form action="action.lasso?" method="post" name="credit" onsubmit="return getTotal(this);">
...
<input type="submit" name="-add" value="credit card">

First of all is it likely to be passed on OK to the next lasso page and secondly how do I pick it up in this lasso page? Can I use an Action_PAram?
Am I on the right lines here?
Any help much appreciated.
Thanks





Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

Nikolaj de Fine Licht
If you want to pass a value from a Javascript to a form, submit that  
form and then pick up the value on the response page you can to write  
a Javascript function which assigns the value to a hidden field in  
the form and then submits the form. On the response page you pick up  
the value with a plain action_param.

The Javascript could look like this (not tested):

<script type="text/javascript">
        function submitValue(el) {
                var elm = document.getElementById(el);
                var val = <here you must set the value you are looking for>;
                elm.value = val;
        document.postform.submit();
        }
</script>

The form could look like this:

<form name="postform" id="postform" method="post"  
action="myResponsePage.lasso">
        <input type="hidden" name="param" id="param" value="" />
        <input type="submit" value="Submit" onclick="submitValue('param');" />
</form>

This should enable you to pick up the value of action_param: 'param'  
on the response page (actually "action.lasso" - but I forgot  
completely how it works if you use action.lasso...)

/nikolaj

On 14. feb 2007, at 17:53, GraemeG wrote:

> I have a Javascript value that I want to pass via a lasso form to  
> another
> lasso page where it is then passed on to a php page using an  
> Include_URL
> along with other values from the form. It works fine for all the  
> values
> except the javascript value  An extract of the form is below and I  
> think the
> value is created by return getTotal(this);
>
> <form action="action.lasso?" method="post" name="credit"  
> onsubmit="return
> getTotal(this);">
> ...
> <input type="submit" name="-add" value="credit card">

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

GraemeG
Ah yes I knew I was missing something major - I'll try this tomorrow.
So close to finishing this project now... this is the last hurdle... I hope.
Thanks again for your help Nikolaj.

Nikolaj de Fine Licht wrote
If you want to pass a value from a Javascript to a form, submit that  
form and then pick up the value on the response page you can to write  
a Javascript function which assigns the value to a hidden field in  
the form and then submits the form. On the response page you pick up  
the value with a plain action_param.

The Javascript could look like this (not tested):

<script type="text/javascript"> function submitValue(el) { var elm = document.getElementById(el); var val = <here you must set the value you are looking for>; elm.value = val; document.postform.submit(); } </script>
The form could look like this:

<form name="postform" id="postform" method="post"  
action="myResponsePage.lasso">
        <input type="hidden" name="param" id="param" value="" />
        <input type="submit" value="Submit" onclick="submitValue('param');" />
</form>

This should enable you to pick up the value of action_param: 'param'  
on the response page (actually "action.lasso" - but I forgot  
completely how it works if you use action.lasso...)

/nikolaj

On 14. feb 2007, at 17:53, GraemeG wrote:

> I have a Javascript value that I want to pass via a lasso form to  
> another
> lasso page where it is then passed on to a php page using an  
> Include_URL
> along with other values from the form. It works fine for all the  
> values
> except the javascript value  An extract of the form is below and I  
> think the
> value is created by return getTotal(this);
>
> <form action="action.lasso?" method="post" name="credit"  
> onsubmit="return
> getTotal(this);">
> ...
> <input type="submit" name="-add" value="credit card">

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

GraemeG
In reply to this post by Nikolaj de Fine Licht
Hello,

I've used your examples and got it to work so I can now pass all the variables I want to the next page, along with the Javascript value. However, when I try to also add some of the form fields to a filemaker database at the same time I get a lasso -9959 add error.
So this line works for adding -
<input type="submit" name="-add" value="Submit">
and this line works for passing the Javascript variable -
<input type="submit" value="Submit" onclick="submitValue('param');" />
but this line gives the add error -
<input type="submit" name="-add" value="Submit" onclick="submitValue('param');" />
I have tried putting the <input type="hidden" name="param" id="param" value="" /> line after the submit line, which is what I have to do for other variables I'm passing that aren't going into the database, but I still get the same error.
Do you, or anyone else know how I can do both at the same time in this form.
Could one way be to pass the variables to the reponse page and then add them to the database from that page via an inline? I would prefer to avoid this way if I can so any other ideas are most welcome.
I've included an extract of the form below

Thanks very much.

<form name="postform" id="postform" method="post" action="completeform.lasso">
<input type="hidden" name="-database" value="databasename">
<input type="hidden" name="-layout" value="web">
...
 <input type="hidden" name="-token.orderdept" value="[Token_value:'orderdept']">//example of field going into database
...
<input type="hidden" name="param" id="param" value="" />
<input type="submit" name="-add" value="Submit" onclick="submitValue('param');" />
</form>



Nikolaj de Fine Licht wrote
If you want to pass a value from a Javascript to a form, submit that  
form and then pick up the value on the response page you can to write  
a Javascript function which assigns the value to a hidden field in  
the form and then submits the form. On the response page you pick up  
the value with a plain action_param.

The Javascript could look like this (not tested):

<script type="text/javascript"> function submitValue(el) { var elm = document.getElementById(el); var val = <here you must set the value you are looking for>; elm.value = val; document.postform.submit(); } </script>
The form could look like this:

<form name="postform" id="postform" method="post"  
action="myResponsePage.lasso">
        <input type="hidden" name="param" id="param" value="" />
        <input type="submit" value="Submit" onclick="submitValue('param');" />
</form>

This should enable you to pick up the value of action_param: 'param'  
on the response page (actually "action.lasso" - but I forgot  
completely how it works if you use action.lasso...)

/nikolaj

On 14. feb 2007, at 17:53, GraemeG wrote:

> I have a Javascript value that I want to pass via a lasso form to  
> another
> lasso page where it is then passed on to a php page using an  
> Include_URL
> along with other values from the form. It works fine for all the  
> values
> except the javascript value  An extract of the form is below and I  
> think the
> value is created by return getTotal(this);
>
> <form action="action.lasso?" method="post" name="credit"  
> onsubmit="return
> getTotal(this);">
> ...
> <input type="submit" name="-add" value="credit card">

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

Nikolaj de Fine Licht
In reply to this post by GraemeG
Hi,

I wish somebody else would chime in because I'm stuck when it comes  
to FileMaker and to using the -add. Seems you can't combine an  
onclick handler with name="-add" in a submit input like this...

Sorry :)

/nikolaj

On 15. feb 2007, at 13:23, GraemeG wrote:

> So this line works for adding -
> <input type="submit" name="-add" value="Submit">
> and this line works for passing the Javascript variable -
> <input type="submit" value="Submit" onclick="submitValue('param');" />
> but this line gives the add error -
> <input type="submit" name="-add" value="Submit"
> onclick="submitValue('param');" />

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

Fletcher Sandbeck
> I wish somebody else would chime in because I'm stuck when it comes
> to FileMaker and to using the -add. Seems you can't combine an  
> onclick handler with name="-add" in a submit input like this...
>
> Sorry :)
>
> /nikolaj
>
> On 15. feb 2007, at 13:23, GraemeG wrote:
>
> > So this line works for adding -
> > <input type="submit" name="-add" value="Submit">
> > and this line works for passing the Javascript variable -
> > <input type="submit" value="Submit" onclick="submitValue('param');"
/>
> > but this line gives the add error -
> > <input type="submit" name="-add" value="Submit"
> > onclick="submitValue('param');" />

What does the function submitValue() do?  If there is only one button on
the form then you might include a hidden input with the -Add action.

[fletcher]
--
Fletcher Sandbeck                         [hidden email]
Director of Product Development       http://www.lassostudio.com
OmniPilot Software, Inc.                http://www.omnipilot.com

============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

Nikolaj de Fine Licht
On 15. feb 2007, at 23:38, Fletcher Sandbeck wrote:

> What does the function submitValue() do?

Its a function I proposed in an earlier reply in order to pass a  
Javascript var along with a form submition - maybe you have a better  
idea?
The function I suggested looks like this:

<script type="text/javascript">
        function submitValue(el) {
                var elm = document.getElementById(el);
                var val = <here you must set the value you are looking for>;
                elm.value = val;
        document.postform.submit();
        }
</script>

And the form outline I suggested:

<form name="postform" id="postform" method="post"  
action="myResponsePage.lasso">
        <input type="hidden" name="param" id="param" value="" />
        <input type="submit" value="Submit" onclick="submitValue('param');" />
</form>

/nikolaj

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

Fletcher Sandbeck
> > What does the function submitValue() do?
>
> Its a function I proposed in an earlier reply in order to pass a  
> Javascript var along with a form submition - maybe you have a better  
> idea?
> The function I suggested looks like this:
>
> <script type="text/javascript">
>   function submitValue(el) {
>       var elm = document.getElementById(el);
>       var val = <here you must set the value you are looking for>;
>       elm.value = val;
>   document.postform.submit();
>   }
> </script>
>
> And the form outline I suggested:
>
> <form name="postform" id="postform" method="post"  
> action="myResponsePage.lasso">
>   <input type="hidden" name="param" id="param" value="" />
>   <input type="submit" value="Submit" onclick="submitValue('param');"
> />
> </form>

What happens if you change the function to the following.  The return
true at the end will make it so the onclick handler is called and then
the normal behavior of the clicked button also happens.

    function submitValue(el) {
        var elm = document.getElementById(el);
        var val = <here you must set the value you are looking for>;
        elm.value = val;
        return true;
    }

I think what might be happening is that the parameter defined by the
button, your -Add action, is never actually submitted with the form.  If
I'm right then the above function should work, but also adding a hidden
-Add input should work.

[fletcher]
--
Fletcher Sandbeck                         [hidden email]
Director of Product Development       http://www.lassostudio.com
OmniPilot Software, Inc.                http://www.omnipilot.com

============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

GraemeG
THanks for this.
I tried the revised Javascript function. It passes the Javascript value OK but again when I include the -Add I still get the -Add error page. THis error page by the way does list all of the values correctly that it is trying to add, including the Javascript value. I tried a hidden -Add input but couldn't get this to work - I got the add error page again.
Any further thoughts on this?
I have taken another approach. Pass the values in the form to the next page and then add them via an inline. THis works OK, the values go into the database OK, but then I can't display them on this same page.
Here is the code (below) that I'm using for this. Is there something else I need to add to the inline maybe?
Thanks again.

[Inline: -Add,
-Database='Databasename',
-Layout='WEB',
'Order ID'=(Action_Param:'Order ID'),
'Customer ID'=(Action_Param:'Customer ID'),
'Name'=(Action_Param:'Name')]
[/Inline]


<p> [Field:'Order ID']</br>
[Field:'Customer ID']</br>
[Field:'Name']</p>



Fletcher Sandbeck wrote
> > What does the function submitValue() do?
>
> Its a function I proposed in an earlier reply in order to pass a  
> Javascript var along with a form submition - maybe you have a better  
> idea?
> The function I suggested looks like this:
>
> <script type="text/javascript"> > function submitValue(el) { > var elm = document.getElementById(el); > var val = <here you must set the value you are looking for>; > elm.value = val; > document.postform.submit(); > } > </script>>
> And the form outline I suggested:
>
> <form name="postform" id="postform" method="post"  
> action="myResponsePage.lasso">
>   <input type="hidden" name="param" id="param" value="" />
>   <input type="submit" value="Submit" onclick="submitValue('param');"
> />
> </form>

What happens if you change the function to the following.  The return
true at the end will make it so the onclick handler is called and then
the normal behavior of the clicked button also happens.

    function submitValue(el) {
        var elm = document.getElementById(el);
        var val = <here you must set the value you are looking for>;
        elm.value = val;
        return true;
    }

I think what might be happening is that the parameter defined by the
button, your -Add action, is never actually submitted with the form.  If
I'm right then the above function should work, but also adding a hidden
-Add input should work.

[fletcher]
--
Fletcher Sandbeck                         fletcher@omnipilot.com
Director of Product Development       http://www.lassostudio.com
OmniPilot Software, Inc.                http://www.omnipilot.com

============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

Nikolaj de Fine Licht
In reply to this post by GraemeG
At any case its better what you do now - to do database action with  
an inline - so keep that!

On the response page, best and easiest is to first set a bunch of  
variables with values corresponding to the action_params, that is you  
do something like this:

var: 'or_id' = action_param: 'Order ID';
var: 'cu_id' = action_param: 'Customer ID';
var: 'c_nme' = action_param: 'Name';

Then you do your inline as before except you use the values from the  
vars instead of the action_params:

[Inline: -Add,
-Database='Databasename',
-Layout='WEB',
'Order ID'=$or_id,
'Customer ID'=$cu_id,
'Name'=$c_nme]
[/Inline]

You can then display your values in the page by simply calling the vars:

<p>
        [$or_id]<br />
        [$cu_id]<br />
        [$c_nme]
</p>

/nikolaj

On 16. feb 2007, at 14:12, GraemeG wrote:

> [Inline: -Add,
> -Database='Databasename',
> -Layout='WEB',
> 'Order ID'=(Action_Param:'Order ID'),
> 'Customer ID'=(Action_Param:'Customer ID'),
> 'Name'=(Action_Param:'Name')]
> [/Inline]
>
> <!-- These fields won't display on the page now, whereas they did  
> before
> when the values were added from the form on the previous page-->
> <p> [Field:'Order ID']</br>
> [Field:'Customer ID']</br>
> [Field:'Name']</p>

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

GraemeG
Thanks very much for this help.
I thought about doing this but the problem is some of the variables are created in the database via a relationship so they are not passed by the form. I think with those I have to directly query the database. I don't understand why the fields can't be picked up after the inline.

Nikolaj de Fine Licht wrote
At any case its better what you do now - to do database action with  
an inline - so keep that!

On the response page, best and easiest is to first set a bunch of  
variables with values corresponding to the action_params, that is you  
do something like this:

var: 'or_id' = action_param: 'Order ID';
var: 'cu_id' = action_param: 'Customer ID';
var: 'c_nme' = action_param: 'Name';

Then you do your inline as before except you use the values from the  
vars instead of the action_params:

[Inline: -Add,
-Database='Databasename',
-Layout='WEB',
'Order ID'=$or_id,
'Customer ID'=$cu_id,
'Name'=$c_nme]
[/Inline]

You can then display your values in the page by simply calling the vars:

<p>
        [$or_id]<br />
        [$cu_id]<br />
        [$c_nme]
</p>

/nikolaj

On 16. feb 2007, at 14:12, GraemeG wrote:

> [Inline: -Add,
> -Database='Databasename',
> -Layout='WEB',
> 'Order ID'=(Action_Param:'Order ID'),
> 'Customer ID'=(Action_Param:'Customer ID'),
> 'Name'=(Action_Param:'Name')]
> [/Inline]
>
>
> <p> [Field:'Order ID']</br>
> [Field:'Customer ID']</br>
> [Field:'Name']</p>

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

Nikolaj de Fine Licht
In reply to this post by GraemeG
On 16. feb 2007, at 15:14, GraemeG wrote:

> I think with those I have to directly query the database.

I would do that in any case to be sure that what you display is  
really what was entered into the database.

I also want to correct myself at one point. This:

var: 'or_id' = action_param: 'Order ID';
var: 'cu_id' = action_param: 'Customer ID';
var: 'c_nme' = action_param: 'Name';

must be changed to:

var: 'or_id' = encode_sql: (action_param: 'Order ID');
var: 'cu_id' = encode_sql: (action_param: 'Customer ID');
var: 'c_nme' = encode_sql: (action_param: 'Name');

/nikolaj

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

GraemeG
Hello,

I have got this to work how I want now.
Instead of adding the values to the database on the original page I just passed them to the response page where I then added them via an inline roughly like this -

[Inline: -Add,
-Database='Databasename',
-Layout='WEB',
'Order ID'=$orderID,
'Customer ID'=$cu_id,
'Name'=$c_nme]
[/Inline]

and then to display the same values + others in the database that weren't added in the inline (such as things like the address) I had to explicitly tell it to do a search in another inline like this -

[Inline: -search,
-Database='Databasename',
-layout='WEB',
'Order ID' = $orderID] // this is the bit it searches on in case someone doesn''t know

[Records]
<p>Your order ID is [Field:'Order ID']
// plus loads of other fields and html
...
[/Records]
[/Inline]

And I had to put the search inline on a separate page calling it from the first page like this passing the OrderID with it.
[Encode_Set: -EncodeNone]
[Include_URL:'http://myaddress.com/Ordering/order_summary_include.lasso', -POSTParams=(array:'orderID'=(var:'orderID'))];
[/Encode_Set]

So out of curiosity - Is it really not possible to refer to a field like so [Field:'Order ID'] in the database that you've just added a record to on the same page with an inline add? I couldn't get this to work but I was sure I'd seen it mentioned somewhere that you could do this. And I'm still a bit mystified as to why I couldn't pass the JAvascript value and the other variables at the same time. Maybe there is another way? Anyway, it's working so I'm happy.

Thanks very much for all your help. It would have taken me a lot longer without it.

GraemeG


Nikolaj de Fine Licht wrote
On 16. feb 2007, at 15:14, GraemeG wrote:

> I think with those I have to directly query the database.

I would do that in any case to be sure that what you display is  
really what was entered into the database.

I also want to correct myself at one point. This:

var: 'or_id' = action_param: 'Order ID';
var: 'cu_id' = action_param: 'Customer ID';
var: 'c_nme' = action_param: 'Name';

must be changed to:

var: 'or_id' = encode_sql: (action_param: 'Order ID');
var: 'cu_id' = encode_sql: (action_param: 'Customer ID');
var: 'c_nme' = encode_sql: (action_param: 'Name');

/nikolaj

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

Nikolaj de Fine Licht
In reply to this post by GraemeG
On 16. feb 2007, at 21:17, GraemeG wrote:

> So out of curiosity - Is it really not possible to refer to a field  
> like so
> [Field:'Order ID'] in the database that you've just added a record  
> to on the
> same page with an inline add? I couldn't get this to work but I was  
> sure I'd
> seen it mentioned somewhere that you could do this.

To make it possible to get the value of a database field using  
[field: 'myField'] you need to perform a lookup, and as far as I know  
the Lasso -add functionality doesn't do any kind of lookup after the  
add action. There are frameworks that do that, in PageBlocks http://
www.pageblocks.org for example you can specify that an add action  
should return the added values as vars after the add. But it does so  
by plain performing a lookup after the add.

> And I'm still a bit mystified as to why I couldn't pass the  
> Javascript value and the other
> variables at the same time.

This I don't get, didn't you succeed to pass all necessary values  
with you form, using that javascript which assigned its value to a  
hidden field?

/nikolaj

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

GraemeG
>This I don't get, didn't you succeed to pass all necessary values  
>with you form, using that javascript which assigned its value to a  
>hidden field?
Yes I did pass all of the values. I don't think I explained it very well.
What I couldn't do was pass the Javascript value to the reponse page and add the other values to the database from the same form on the original page. This is why I passed the other values to the reponse page and added them to the database in the inline from there. I didn't need to add the Javascript value to the database - just pass it on.


Nikolaj de Fine Licht wrote
On 16. feb 2007, at 21:17, GraemeG wrote:

> So out of curiosity - Is it really not possible to refer to a field  
> like so
> [Field:'Order ID'] in the database that you've just added a record  
> to on the
> same page with an inline add? I couldn't get this to work but I was  
> sure I'd
> seen it mentioned somewhere that you could do this.

To make it possible to get the value of a database field using  
[field: 'myField'] you need to perform a lookup, and as far as I know  
the Lasso -add functionality doesn't do any kind of lookup after the  
add action. There are frameworks that do that, in PageBlocks http://
www.pageblocks.org for example you can specify that an add action  
should return the added values as vars after the add. But it does so  
by plain performing a lookup after the add.

> And I'm still a bit mystified as to why I couldn't pass the  
> Javascript value and the other
> variables at the same time.

This I don't get, didn't you succeed to pass all necessary values  
with you form, using that javascript which assigned its value to a  
hidden field?

/nikolaj

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Pass Javascript value to another lasso page

Nikolaj de Fine Licht
In reply to this post by GraemeG
On 19. feb 2007, at 18:04, GraemeG wrote:

> What I couldn't do was pass the Javascript value to the reponse  
> page and add the other values to the database from the same form on  
> the original page.

OK, I may very well not understand exactly what you wanted to do -  
but IF I understand it right, then I still don't see where you would  
run into problems. It sounds like a fairly common situation you are  
trying to solve.

Have you looked at the wonderful LASSO TIPS FOR NEWBIES? Here  
"Newbies" should not be taken literally (offending) at all, its a  
very fine collection of best practises, useful for all who knows they  
don't know everything. You could look at this one for example: http://
www.listsearch.com/lassotalk.lasso?id=193788

Usually, when you submit a form you submit it with all values you  
need on the response page - wether or not they need to go into the  
database.

On the response page you convert all these passed values to vars.

Those vars you need for interacting with the database you use for that.
Those vars you just need for display you use for that.

You should make your response page with a "programming layout"  
consisting of two sections: one section in pure lassoscript which  
does all the logic and another section which is the actual html going  
to be displayed. So you have:

<?lassoscript

        logic

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

        here all your html and Lasso in [ ]

</html>

So you would put all your param->var validation/conversion- and  
database-stuff in that first section, and html and display of Lasso-
vars etc. in that second section.

Thinking along these lines is what makes me still not quite get why  
you couldn't handle all your var- and database-stuff in the one and  
same response page...

/nikolaj

_____________________________________
Nikolaj de Fine Licht  •  Music&Media
Web Solutions for Cultural Businesses
http://www.musicmedia.dk



============================================
Attend the Lasso Summit
March 2-4, 2007 in Fort Lauderdale, FL
http://www.LassoSummit.com/
============================================

------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage