You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lally Singh <la...@gmail.com> on 2007/03/26 22:15:34 UTC

CForms & Views

Hey all, I'm building a small survey application.  I've been trying to
go along with the CForms docs, but find some good gaps in my
understanding of how to do stuff.


Specifically, I've got a system that generates questions based on two
parameters (a class ID like 'ECE2504' and a term ID like '200701'),
and was hoping to use views to generate the definition and template
files.

Can I invoke views with parameters here?  Something like this:
function doSurvey (course, term) {
   var form = new Form ("generate-questions?cocoon-view=form-def");
   form.showForm("generate-questions?cocoon-view=form-disp", {
course=course, term=term });
   // I'll have to figure out how to store these results here, somehow.
   cocoon.sendPage ("surveyDone");
}

I know showForm() can take in a map of parameters, but I didn't see
anything like that for Form().

Thanks in advance for any help!

-ls

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms & Views

Posted by Jeroen Reijn <j....@hippo.nl>.
Hi Lally,

Lally Singh wrote:
> 
> Specifically, I've got a system that generates questions based on two
> parameters (a class ID like 'ECE2504' and a term ID like '200701'),
> and was hoping to use views to generate the definition and template
> files.
> 
> Can I invoke views with parameters here?  

Well yes that should be possible. I haven't tried it, but it should work.

Something like this:
> function doSurvey (course, term) {
>   var form = new Form ("generate-questions?cocoon-view=form-def");
>   form.showForm("generate-questions?cocoon-view=form-disp", {
> course=course, term=term });
>   // I'll have to figure out how to store these results here, somehow.
>   cocoon.sendPage ("surveyDone");
> }
> 
> I know showForm() can take in a map of parameters, but I didn't see
> anything like that for Form().

No as far as I can see you can't send a map of parameters to the Form 
function. You might be able to send them as request parameters though.

> 
> Thanks in advance for any help!
> 
> -ls

Jeroen Reijn
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CForms & Views

Posted by Grzegorz Kossakowski <gk...@apache.org>.
Lally Singh napisaƂ(a):
> Hey all, I'm building a small survey application.  I've been trying to
> go along with the CForms docs, but find some good gaps in my
> understanding of how to do stuff.
>
>
> Specifically, I've got a system that generates questions based on two
> parameters (a class ID like 'ECE2504' and a term ID like '200701'),
> and was hoping to use views to generate the definition and template
> files.
>
> Can I invoke views with parameters here?  Something like this:
> function doSurvey (course, term) {
>   var form = new Form ("generate-questions?cocoon-view=form-def");
>   form.showForm("generate-questions?cocoon-view=form-disp", {
> course=course, term=term });
>   // I'll have to figure out how to store these results here, somehow.
>   cocoon.sendPage ("surveyDone");
> }
>
> I know showForm() can take in a map of parameters, but I didn't see
> anything like that for Form().

You can include parameters in query string but it must be a call to
sitemap ;)
I think you want to do this:
var form = new Form ("cocoon:/generate-questions?cocoon-view=form-def");

-- 
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org