Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8448399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:25:02+00:00 2026-06-10T10:25:02+00:00

I am using Catalyst Perl MVC framework with HTML::FormHandler as forms processor. Are there

  • 0

I am using Catalyst Perl MVC framework with HTML::FormHandler as forms processor.

Are there any ways to create multiple objects and save them into appropriate separate tables using single form?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:25:03+00:00Added an answer on June 10, 2026 at 10:25 am

    After some time was spent reading the documentation and finally IRC help I figured out how to do it. It’s quite simple.

    Let’s say we have 2 related tables: ‘account’ and ‘user’. And ‘account’ hasMany ‘users’, with this relationship being called ‘users’.

    The code in controller Account.pm stays the same (remember we are using HTML::FormHandler to process the form and create new objects):

    sub register : Chained('base') :PathPart('register') :Args(0) {
        my ($self, $c ) = @_;
        my $account = $c->model('DB::Account')->new_result({});
        return $self->form_create($c, $account);
    }
    sub form_create {
        my ( $self, $c, $account ) = @_;
        my $form = MyApp::Form::Account->new();
        $c->stash( template => 'account/form.tt2', form => $form );
        $form->process( item => $account, params => $c->req->params );
        return unless $form->validated;
    }
    

    All we do is use http://metacpan.org/pod/HTML::FormHandler::Field::Repeatable like that in our lib/MyApp/Form/Account.pm:

    package MyApp::Form::Account;
    
    use HTML::FormHandler::Moose;
    extends 'HTML::FormHandler::Model::DBIC';
    use namespace::autoclean;
    
    has '+item_class' => ( default => 'Account' );
    has_field 'organization';
    # other fields ...
    
    # User Part Form
    has_field 'users' => ( type => 'Repeatable' ); # 'users' is our relationship name!
    has_field 'users.first';
    has_field 'users.last';
    # and so on...
    has_field 'submit' => ( type => 'Submit', value => 'Submit' );
    __PACKAGE__->meta->make_immutable;
    1;
    

    After submitting we get freshly created ‘account’ and ‘user’ objects, where ‘user’ already has corresponding ‘account_id’ inserted 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using HTML::FormHandler for a web app I'm creating. The forms work fine,
I'm writing a web application using the Catalyst framework . I'm also using a
I've written a web application using Catalyst that has a lot of forms and
I am trying to create a model for Catalyst by using DBIx::Class::Schema::Loader. I want
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using HTML 5, I want to play multiple sounds simultaneously. how can I do
I'm using Catalyst for my Perl web app. What is the accepted way of
I have created one Catalyst application and I have created Schema and Model using
I'm attempting to implement a Catalyst application using nginx as a frontend web proxy
I'm using the Assets plugin in my Catalyst app, and I would like some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.