UPDATE: Looks like there was some issues with my HTML:

<!--TMPL_INCLUDE name="header.html"--> <p>Sign our guestbook!</p> <form action="" method="post"> <input type="hidden" name="create" value="yes" /> <input type="hidden" name="m" value="sign" /> <-- needed this to post +to the correct run mode <p>Name:<input type="text" name="name" /></p> <p>Email:<input type="text" name="email" /><input type="checkbox" name +="hide_email" /> Hide email</p> <p>Website:<input type="text" name="website" value="http://" /></p> <p>Comments:</p> <p><textarea name="comments" rows="10" columns="45"></textarea></p> <p><input type="submit" name="Post your comment" /></p> </form> <!--TMPL_INCLUDE name="footer.html"-->

Howdy all,

I just started using DBIx::Class, in lieu of Class::DBI basically. Retrieving is going great however I seem to be having some troubles createing.

UPDATE:Apparently I wasn't clear enough when i said that the record wasn't being created at all, there are no error messages being returned, the script just isn't creating a record.

My code is posted below, I think all that is posted is necessary to see the issue, along with the HTML form.

Let me know if you have any ideas...

Code:

sub sign { my $self = shift; my $q = $self->query; my $tmpl = $self->load_tmpl( 'comment.html', %config_vars ); ############################# # cleaning the HTML # we use HTML::Scrubber to clean up the HTML so our code doesn't b +reak use HTML::Scrubber; my $name = $q->param('name'); my $email = $q->param('email'); my $website = $q->param('comments'); my $hide_email = $q->param('hide_email'); my $comments = $q->param('comments'); # let's create an array of the params in this form: my @form_data = ( $name, $email, $website, $comments, $hide_email +); # the HTML::Scrubber object # allow <br /> <p> <b> <i> <u> <hr /> # this will be put into a config file eventually (aka upon product +ion) my $scrubber = HTML::Scrubber->new( allow => [ qw[ p b i u hr br ] + ] ); # deny list # deny <link> <a> *<script>*<- especially, <style> $scrubber->deny( qw[ link a href script style ] ) ; # scrub all the form data passed to this script... $scrubber->scrub( $_ ) for @form_data; ############################## # time to create a new comment... my $comment; if ( $q->param('create') eq "yes" ) { $comment = $schema->resultset('Comments')->create( { name => $name, email => $email, website => $website, comments => $comments, hide_email => $hide_email, } ); $comment->update; return qq{Thank you for your comments! <a href='?'>&laquo;back +</a>}; } $tmpl->output unless $q->param('create'); }

HTML(with HTML::Template tags):

<!--TMPL_INCLUDE name="header.html"--> <p>Sign our guestbook!</p> <form action="" method="post"> <input type="hidden" name="create" value="yes" /> <p>Name:<input type="text" name="name" /></p> <p>Email:<input type="text" name="email" /><input type="checkbox" name +="hide_email" /> Hide email</p> <p>Website:<input type="text" name="website" value="http://" /></p> <p>Comments:</p> <p><textarea name="comments" rows="10" columns="45"></textarea></p> <p><input type="submit" name="Post your comment" /></p> </form> <!--TMPL_INCLUDE name="footer.html"-->
meh.

In reply to Problems with DBIx::Class and CGI::Application by stonecolddevin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.