Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Using a independent form with gforum.cgi

Quote Reply
Using a independent form with gforum.cgi
Hi,

I would like to know if there is a way to pass form values to another page (template) by using <form action="gforum.cgi" method=post>. I don't want that the values be recorded in the database, only print them in another page generated by gforum.cgi.

Thank you your help!

François
Quote Reply
Re: [Franco] Using a independent form with gforum.cgi In reply to
Can you explain a little more what you're trying to do?

It is possible to post to gforum.cgi, which is exactly what GForum does for everything it does, from an external page.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Using a independent form with gforum.cgi In reply to
Actually I want to create a page (dynamic page from a template) that allows users to preview a form (values from a form) before send it. I don't want to put the form values in the database, I only want to use the temporary values from the form in the preview page.

Steps the user will do:
1) The user will fill the form generated from a template.
2) Then he will click on the button «Next» or «Preview».
3) The values in the form will be passed throw gforum.cgi to another page generated from a template. The user will see the preview of his form, and then he will send it if it's ok. The form will be sent throw a external script (not gforum.cgi). But I need that gforum.cgi sends the values from the form to another page (dynamic page from a template).

Is it possible to do that?

Thank you!

François
Quote Reply
Re: [Jagerman] Using a independent form with gforum.cgi In reply to
The button «Switch to Basir Editor» do already what I want to do: it pass the variables to another page without records them in the database. I just want to know how I can do this between two of my own templates.

Thanks!

François
Quote Reply
Re: [Franco] Using a independent form with gforum.cgi In reply to
And you want to use GForum to do this? I think the easiest thing to do would be to create a global call get_cgi_input, and set it to:

sub { $IN->get_hash }

Then, add:

<%get_cgi_input%>

at the top of the page, and you can now use any of the CGI parameters on the page. So, if someone passed in: .....gforum.cgi?post_message=This_is_my_post

you could use <%post_message%> to display:

This_is_my_post

Is that the sort of thing you're after?

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Using a independent form with gforum.cgi In reply to
Thank you, Jason!! It works! With the global I can now pass variables from a form (not a link) to another page. For the form, I use this:

<form action="forum.cgi" method="POST" enctype="multipart/form-data">
...
<input type="submit" class="submit" name="do=page2;<%hidden_query%>" value="Preview">
</form>

Last thing: In my form I use a multiple select values (<select size="10" name="forums_choice" multiple>). When the user select more than one value I get "ARRAY(0x84a15d8)" when I try to print <%forums_choice%>. When I print <%GT::Template::dump%>, I can see the user values for "forums_choice" like this: "$VAR = [
'forum=1',
'forum=2',
'forum=3',
'forum=4',
'forum=5'
];"


How can I print all the forums_choice values (forum=1, forum=2, forum=3, forum=4, forum=5) in the template? I would like that the values be separated by commas.

Thank you very much!

Sorry for my bad english...

François
Quote Reply
Re: [Franco] Using a independent form with gforum.cgi In reply to
Change the global, like this:

Code:
sub {
my $in = $IN->get_hash;
for (keys %$in) {
$in->{$_} = join ', ', @{$in->{$_}} if ref $in->{$_} eq 'ARRAY';
}
$in
}

Alternatively, if you _know_ that it will always be multiple form values, you can do:

<%loop forums_choice%><%loop_value%><%endloop%>

The only problem is that it will break if only one forums_choice= is passed in.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com

Last edited by:

Jagerman: Apr 21, 2003, 12:46 AM
Quote Reply
Re: [Jagerman] Using a independent form with gforum.cgi In reply to
Thank you for your answer. The new global doesn't work, the variables are not passed in (get unknown tag).

Thank you!

François
Quote Reply
Re: [Franco] Using a independent form with gforum.cgi In reply to
Oops, okay, I fixed it above

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Using a independent form with gforum.cgi In reply to
Thank you again, Jason! Gossamer Forum is a really powerful script and your support could not be better! Smile

François