[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Dates for the MiniDebConf '14 finalized !



Quoting Pooja Prakash (2014-08-03 17:25:25)
> The website will be ready as soon as possible. We are working on it.
> For the registration form, I suggest using Google forms instead. 
> Please find a attached html file.  
> If anybody have suggestions, please let us know.

I don't know what "Google forms" is, but I suspect it is a service 
offered by Google, which implies that data is shared with Google.

Even if you who setup this website have no problem with Google 
collecting data, please beware that others interested in the MiniDebconf 
may have concerns with that and such choice may even discourage some 
people from attending the conference/gathering.

Attached is a simple web form CGI script, which triggers an email.  Feel 
free to borrow and extend that.  Tell me if you need help using it.


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private
#!/usr/bin/perl -w

use CGI::FormBuilder;
use utf8::all;

# Set this to 1 for a separate confirmation page
my ($confirm) = 1;

# Built-in email validation is too simplistic
my $valid_email = '/^[+_A-Za-z0-9-]+(\.[+_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[_A-Za-z0-9-]+)$/';

my $form = CGI::FormBuilder->new(
	lang => 'da',
	title => 'Tilmelding',
	method => 'POST',
	fields => [qw/
		navn
		adresse
		email
		tlf
		betalt
	/],
	validate => {
		email => $valid_email,
		_email => $valid_email, #fake check to silence warning of variable used only once
	},
	required => [qw/
		navn
		adresse
		tlf
		email
	/],
	messages => ':da_DK',
	submit => ['Send dette til Orønyt'],
	action => 'http://blanket.oroenyt.biks.dk/tilmeld/', #avoids loosing submitted values when redirected from other site
);

$form->field(
	name => 'navn',
	label => 'Mit navn',
);
$form->field(
	name => 'adresse',
	label => 'Min adresse',
	type => 'textarea',
	rows => 3,
);
$form->field(
	name => 'betalt',
	label => 'Jeg har indbetalt kr. 100,- til konto 9040 4577823532',
	options => ['ja'],
);

my ($form_required_text) = $form->{opt}{messages}{form_required_text};
my ($mail_from) = $form->field('email') || undef;
my ($mail_to, $mail_subject);

if ($form->submitted) {
	$infostring = "Tak for din tilmelding, den vil blive ekspederet hurtigst muligt!";
	if ($form->validate) {
		$mail_to = 'redaktionen@oroenyt.dk';
#		$mail_to = 'jonas@localhost';
		$mail_subject = 'Tilmelding til Orønyt';
	} else {
		$mail_to = 'redaktionen@oroenyt.dk';
#		$mail_to = 'jonas@localhost';
		$mail_subject = 'FEJL ved tilmelding til Orønyt';
		$infostring .= "\n<P>OBS! Der var fejl i et eller flere af felterne. Tilmeldingen er sendt uanset, men det anbefales at gå tilbage, checke at alle felter er udfyldt korrekt, og derefter sende blanketten igen.";
		$confirm = 0;
	};
#	if ($form->field('email')) {
#		$infostring .= "\n<P>Der er sendt en kopi af tilmeldingen til " . $form->field('email') . ".";
#		$mail_to .= ', ' . $form->field('email');
#	}
	# Abuse subject to add additional headers
#	$mail_subject .= "\n" . 'Content-Type: text/plain; charset="ISO-8859-1";';
#	$mail_subject .= "\n" . 'Content-Transfer-Encoding: 8bit';
	$form->mailresults(
		to	=> "$mail_to",
		from	=> $mail_from,
#		subject	=> "$mail_subject: " . $form->field('brugergruppe_navn'),
		subject	=> "$mail_subject",
	);
	if ($confirm) {
		$infostring .= "\n<P>Følgende informationer er blevet sendt:";
		$form->{opt}{messages}{form_confirm_text} = "$infostring";
		print $form->confirm(
			header		=> 1,
#			template	=> '/var/www/vhosts/jonas/blanket.oroenyt.biks.dk/tilmeld/tak/index.html'
		);
	} else {
		print $form->render(
			header		=> 1,
			sticky		=> (! $form->validate),
#FIXME			text		=> $infostring,
#			template	=> '/var/www/vhosts/jonas/blanket.oroenyt.biks.dk/tilmeld/index.html'
		);
	}
} else {
	print $form->render(
		header		=> 1,
#		template	=> '/var/www/vhosts/jonas/blanket.oroenyt.biks.dk/tilmeld/index.html'
	);
}

Attachment: signature.asc
Description: signature


Reply to: