[jifty-devel] Radio button and Ajax

benchiheub jamalle.benchiheub at univ-metz.fr
Mon Nov 6 10:58:02 EST 2006

I use Jifty since a few days.
But i have some difficulties to use Ajax and button radio.  In Fact i 
would like to show an input field after i click on the right option.  I 
suppose i must use PageRegion but i don't manage to refresh the region.
Thanks for help.

My entry.html

my $action = Jifty->web->new_action( class => 'Entry',moniker => 

<&|/_elements/wrapper, title => "Post your Entry" &>
<%Jifty->web->region(name => 'autre',
                        path => 'fonction.comp',
<%Jifty->web->form->submit(label => 'Vas y')%>

My fonction.comp


my $action=Jifty->web->new_action(class => "EntryAutre",moniker => 

% if ($fonction=~/Autre/i) {
% }

My Entry.pm

use strict;
use warnings;

=head1 NAME



package Cpu::Action::Entry;
use base qw/Cpu::Action Jifty::Action/;
use Jifty::Param::Schema;
use Jifty::Action schema {

param adresse =>
        label is 'Adresse',
        is mandatory;

param ville =>
        label is 'Categorie';

param fonction =>
        label is 'Fonction',
        ajax validates,
        render as 'radio',
        valid are qw ( Président Directeur Vice-Pdt Autre );

param corps =>
        label is 'Corps',
        render as 'Textarea';
=head2 take_action


sub validate_fonction {
        my $self=shift;
        my $fonction=shift;
        if ($fonction=~/Autre/)
                return $self->validation_error( fonction => 'Saisir 
votre fonction');        }
        return $self->validation_ok('fonction');
=head2 report_success


sub take_action {
    my $self = shift;

    # Custom action code

    $self->report_success if not $self->result->failure;

    return 1;=cut

sub report_success {
    my $self = shift;
    # Your success message here


Université Paul Verlaine-Metz
Centre de ressources informatiques
Tel : 03 87 54 70 85

More information about the jifty-devel mailing list