The parameter value will be captured when the form is generated and  
will stay at that value as long as it's captured. Maybe I'm  
misunderstanding what you mean, but I thought what you meant is that  
you have a page with a query parameter "id", which has a form on it  
generated by chooseIndex, and you want the functions that handle the  
submission of that form to use the id parameter that was passed in  
originally. Capturing the param like I exampled should do that for you.

I'm sorry if I'm misunderstanding your problem -- if this isn't what  
you want could you make a small example and post it so that we can  
look at the whole code?

-Ross

On Nov 24, 2009, at 2:26 PM, DavidV wrote:

> Capturing the value depends on reading it from the URL as a parameter,
> so even if it's local, after I submit the form and the page reloads
> without the "id" parameter in the URL, I still get the None.get error
> because it is trying find a parameter that isn't there.  I need some
> way to keep the parameter in the URL after the form is submitted...
>
> On Nov 24, 2:10 pm, Ross Mellgren <dri...@gmail.com> wrote:
>> Try capturing it as a local variable?
>>
>> e.g.
>>
>> def chooseIndex(ns: NodeSeq): NodeSeq = {
>>    val myParam = S.param("id")
>>    def getImgs(s: String) = /* work with myParam here */
>>    <td>..</td>
>>
>> }
>>
>> If you want getImgs to be outside, then you can pass it in,
>>
>> def getImgs(s: String, myParam: Option[String]) = ...
>>
>> def chooseIndex(ns: NodeSeq): NodeSeq = {
>>      val myParam = S.param("id")
>>     <td>{ submit(..., () => getImgs("met", myParam)) }</td>
>>
>> }
>>
>> -Ross
>>
>> On Nov 24, 2009, at 2:02 PM, DavidV wrote:
>>
>>> I have searched a number of threads and have found similar posts but
>>> nothing the exactly answers this relatively simple question.
>>> I am using the Lift submit method (net.liftweb.http.Shtml.submit) to
>>> submit a form.  Upon submission, I want to execute another method
>>> called getImgs(s: String), so I have set up my submit button as so:
>>
>>> def chooseIndex: NodeSeq = {
>>> ...
>>> <td>{submit("Metabolic Reserve Index", () => getImgs("met"))}</td>
>>> ...
>>> }
>>
>>> In my .html file for this page I call the snippet with form="post"
>>> <lift:PortalHome.chooseIndex form="post" />
>>
>>> The getImgs method has a variable that relies on a URL parameter  
>>> that
>>> is lost when I click the submit button, so my S.param("id").get
>>> returns a None.get error.  How can I retain the parameter through  
>>> the
>>> submit process?  Is it best to use a StatefulSnippet?  Can I read in
>>> the parameter as an attribute?  I feel like like there are a  
>>> number of
>>> ways to accomplish this, but what is the best, or most "lifty" way?
>>
>>> Thanks,
>>> David
>>
>>> --
>>
>>> You received this message because you are subscribed to the Google
>>> Groups "Lift" group.
>>> To post to this group, send email to lift...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> liftweb+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group 
>>> athttp://groups.google.com/group/liftweb?hl=en
>>> .
>
> --
>
> You received this message because you are subscribed to the Google  
> Groups "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to 
> liftweb+unsubscr...@googlegroups.com 
> .
> For more options, visit this group at 
> http://groups.google.com/group/liftweb?hl=en 
> .
>
>

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to