Skip to content

Instantly share code, notes, and snippets.

@slischka
Last active March 2, 2020 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slischka/0e6893da361c7aaaa12358878a178233 to your computer and use it in GitHub Desktop.
Save slischka/0e6893da361c7aaaa12358878a178233 to your computer and use it in GitHub Desktop.
Customizace fapi formulářů
window.jQueryFapi('[name="notes"]')
.closest('tr')
.after(
'<tr><th></th><td class="form_container_description">' +
'Tady dejte vlastní text.' +
'</td></tr>'
);
var allowedStateCodes = ['DE', 'AT', 'CZ', 'SK'];
window.jQueryFapi('#frm-state option').each(function () {
var item = window.jQueryFapi(this);
if (allowedStateCodes.indexOf(item.val()) === -1) {
item.remove();
}
});
var $table = window.jQueryFapi('.fapi-form-personal-information').find('table');
$table.find("[name='ic_dph']").closest('tr').prependTo($table);
$table.find("[name='dic']").closest('tr').prependTo($table);
$table.find("[name='ic']").closest('tr').prependTo($table);
$table.find(".form_container_description").closest('tr').prependTo($table);
$table.find("[name='company']").closest('tr').prependTo($table);
var $terms = window.jQueryFapi('.fapi-terms');
var $a = $terms.find('a');
$terms.text('Můj nový text před odkazem');
$a.text('Můj nový text odkazu');
$terms.append(' ').append($a).append('.');
jQueryFapi('.frm-showUserForm input[name=email]').on('input', function () {
var $email = jQueryFapi(this);
var emailValue = $email.val();
var blackListedEmails = ['test@fapi.cz'];
if (blackListedEmails.indexOf(emailValue) >= 0) {
$email.closest('form').find('input[name=_submit]').hide();
} else {
$email.closest('form').find('input[name=_submit]').show();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment