X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Felements%2Fedit.html;h=2f82f9c999b7cab0ee0dbc0e96248321cd027191;hp=c6d45531e80a43082cc1c92f5a0555e70bfe73d3;hb=dd43be3233e0411109342c691a47d1b6d6747015;hpb=5b507bd1cb845ef44a49f84d4f0ae20ec80118d5 diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index c6d45531e..2f82f9c99 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -240,6 +240,7 @@ Example: % my $url = $opt{'post_url'} || popurl(1)."process/$table.html"; +% $js_form_validate = { 'edit_topform' => { 'name' => 'edit_topform' } };
- + <% defined($opt{'form_init'}) ? ( ref($opt{'form_init'}) @@ -357,21 +358,23 @@ Example: % #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 % qw( formatted_value ), #fixed % qw( country ), #select-country % qw( width height config ), #htmlarea -% qw( alt_format ), #select-cust_location +% qw( is_optional alt_format ), #select-cust_location % qw( classnum ), # select-inventory_item % qw( aligned ), # columnstart +% qw( debug ), # select-table % ; % % #select-table @@ -407,6 +410,13 @@ 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", @@ -631,6 +641,15 @@ Example: return; } +% if ( exists( $f->{'js_spawn_test'} ) ) { + // XXX check a passed-in hook here and optionall return + if ( <% $f->{'js_spawn_test'} %> ) { + // then go ahead and spawn + } else { + return; + } +% } + // change the label on the last entry & add a remove button var prev_label = document.getElementById('<% $field %>_label' + <%$field%>_fieldnum ); prev_label.innerHTML = ' <% $f->{'m2_label'} || $field %>'; @@ -650,7 +669,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 eq 'selectlayersx') || ($type =~ /^select-cgp_rule_/) ) { var newfunc = <% include(@layer_opt, js_only=>1) |js_string %>; % } else { var newfunc = ''; @@ -833,7 +852,11 @@ Example: : $opt{'html_foot'} %> - <% include("/elements/footer.html") %> +% my %footerdata = ( +% 'formvalidation' => $js_form_validate, +% ); + + <% include("/elements/footer.html", %footerdata) %> % } <%init> @@ -851,6 +874,8 @@ my $fields = $opt{'fields'} || [ grep { $_ ne $pkey } fields($table) ]; #my @actualfields = map { ref($_) ? $_->{'field'} : $_ } @$fields; +my $js_form_validate = {}; + my( $mode, $object); my $clone = ''; if ( $opt{'embed'} ) {