X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Felements%2Fedit.html;h=a238a3f045d57cf8420382f3bb5bcafd29c20e9a;hb=088d455c563ca3b75be357727622d968e49b3ed1;hp=b1641138bd6a00f3a923be020eb7f29b5e4c299d;hpb=c9994d080422aec5188ee08851a493ce1794c3b7;p=freeside.git diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index b1641138b..a238a3f04 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -114,6 +114,9 @@ Example: #we're in a popup (no title/menu/searchboxes) 'popup' => 1, + #if you need to access the submit button + 'submit_id' => 'mysubmitbuttonid', + #we're embedded (rows only: no header at all, no html_init, no error # display, no
, no hidden fields for table name or primary key, no # display of primary key, no submit button, no html_foot, no footer) @@ -231,6 +234,7 @@ Example: % my $url = $opt{'post_url'} || popurl(1)."process/$table.html"; +% $js_form_validate = { 'edit_topform' => { 'name' => 'edit_topform' } }; $f->{'size'}, % 'maxlength' => $f->{'maxlength'}, +% 'prefix' => $f->{'prefix'}, % 'postfix' => $f->{'postfix'}, % % #textarea @@ -327,12 +332,16 @@ Example: % #any? % 'colspan' => $f->{'colspan'}, % 'required' => $f->{'required'}, +% +% #contact +% 'custnum' => $f->{'custnum'}, +% 'prospectnum' => $f->{'prospectnum'}, % ); % % $include_common{$_} = $f->{$_} foreach grep exists($f->{$_}), % qw( js_only html_only select_only layers_only cell_style ),#selectlayers,? % qw( empty_label ), # select-* -% qw( value_col compare_sub order_by ), # select-table +% qw( value_col compare_sub order_by addl_from ), # select-table % qw( table name_col ), #(select,checkboxes)-table % qw( target_table link_table ), #checkboxes-table % qw( hashref agent_virt agent_null agent_null_right ),#*-table @@ -365,6 +374,8 @@ Example: % % my $layer_prefix_on = ''; % +% my $submitid = $opt{submit_id} ? $opt{submit_id} : ''; +% % my $include_sub = sub { % my %opt = @_; % @@ -377,11 +388,19 @@ Example: % $include_common{'layer_prefix'} = "$field$fieldnum." % if $layer_prefix_on; % +% ## set conditionname field values for validation. +% if ($field eq 'conditionname') { +% my $validate_field = $field . $fieldnum . '.after_event.run_delay'; +% $js_form_validate->{edit_topform}->{validate_fields}{$validate_field} = 'digits: true'; +% $js_form_validate->{edit_topform}->{error_message}{$validate_field} = 'Please only enter numbers here.'; +% } +% % my @include = % ( "/elements/$include.html", % 'field' => "$field$fieldnum", % 'id' => "$field$fieldnum", #separate? % 'label_id' => $field."_label$fieldnum", #don't want field0_label0... +% 'submit_id' => $submitid, % %include_common, % %opt, % ); @@ -394,6 +413,7 @@ Example: % 'value' => $opt{curr_value}, % 'label' => $label, % 'noinit' => $f->{noinit}, +% 'required' => $f->{'required'}, % } % ); % } @@ -619,7 +639,7 @@ Example: var newrow = <% include(@layer_opt, html_only=>1) |js_string %>; % #until the rest have html/js_only -% if ( $type eq 'selectlayers' || $type =~ /^select-cgp_rule_/ ) { +% if ( $type eq 'selectlayers' || $type =~ /^select-cgp_rule_/ || $type eq 'contact') { var newfunc = <% include(@layer_opt, js_only=>1) |js_string %>; % } else { var newfunc = ''; @@ -802,7 +822,11 @@ Example: : $opt{'html_foot'} %> - <% include("/elements/footer.html") %> +% my %footerdata = ( +% 'formvalidation' => $js_form_validate, +% ); + + <% include("/elements/footer.html", %footerdata) %> % } <%init> @@ -818,7 +842,11 @@ my $pkey = dbdef->table($table)->primary_key; #? $opt{'primary_key'} || my $fields = $opt{'fields'} #|| [ grep { $_ ne $pkey } dbdef->table($table)->columns ]; || [ grep { $_ ne $pkey } fields($table) ]; -#my @actualfields = map { ref($_) ? $_->{'field'} : $_ } @$fields; +my @actualfields = map { ref($_) ? $_->{'field'} : $_ } @$fields; + +push @actualfields, $pkey; + +my $js_form_validate = {}; my( $mode, $object); my $clone = ''; @@ -859,7 +887,7 @@ if ( $opt{'embed'} ) { $mode = 'error'; $object = $class->new( { - map { $_ => scalar($cgi->param($_)) } fields($table) + map { $_ => scalar($cgi->param($_)) } @actualfields }); &{$opt{'error_callback'}}( $cgi, $object, $fields, \%opt )