Skip to content

Commit

Permalink
Fix multiple output of JS on failed form submission
Browse files Browse the repository at this point in the history
  • Loading branch information
kksidd committed Aug 28, 2016
1 parent 4d27277 commit ae59c60
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions couch/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,7 @@ function date_dropdowns( $date='', $simple_mode=0 ){
$s = substr( $date, 17, 2 );

$year = '<input class="year-field" type="text" id="f_k_year" name="f_k_year" value="' . $yy . '" size="4" maxlength="4" autocomplete="off" />';
if( $simple_field ){
if( $simple_mode ){
$month = '<select class="month-field" id="f_k_month" name="f_k_month">'."\n";
}
else{
Expand All @@ -1541,7 +1541,7 @@ function date_dropdowns( $date='', $simple_mode=0 ){
$month .= '>'.$v.'</option>';
}
$month .= '</select>';
if( !$simple_field ){
if( !$simple_mode ){
$month .= '<span class="select-caret">'.$FUNCS->get_icon('caret-bottom').'</span></div>';
}
$day = '<input class="day-field" type="text" id="f_k_day" name="f_k_day" value="' . $dd . '" size="2" maxlength="2" autocomplete="off" />';
Expand Down Expand Up @@ -3936,15 +3936,33 @@ function load_css( $src='' ){
}

function add_js( $code ){
$this->admin_js .= $code . "\r\n";
static $sig = array();

$hash = MD5( $code );
if( !isset($sig[$hash]) ){
$this->admin_js .= $code . "\r\n";
$sig[$hash] = 1;
}
}

function add_css( $css ){
$this->admin_css .= $css . "\r\n";
static $sig = array();

$hash = MD5( $css );
if( !isset($sig[$hash]) ){
$this->admin_css .= $css . "\r\n";
$sig[$hash] = 1;
}
}

function add_html( $html ){
$this->admin_html .= $html . "\r\n";
static $sig = array();

$hash = MD5( $html );
if( !isset($sig[$hash]) ){
$this->admin_html .= $html . "\r\n";
$sig[$hash] = 1;
}
}

function get_js(){
Expand Down

0 comments on commit ae59c60

Please sign in to comment.