EasyUI Forum
April 23, 2024, 06:49:12 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Disable entire form  (Read 6338 times)
joe
Newbie
*
Posts: 33


View Profile Email
« on: July 05, 2017, 11:38:07 AM »

is there a method i can use to disable the entire from after submit?  for example:
Code:
$(this).form('disable')
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: July 05, 2017, 05:01:49 PM »

You could show a mask or use the $.messager.progress to display a waiting message after submitting your form.
Logged
joe
Newbie
*
Posts: 33


View Profile Email
« Reply #2 on: July 05, 2017, 09:22:13 PM »

I need to disable all fields on the form after submit.  I basically need the form to become read only after submit.
Logged
sky-t
Full Member
***
Posts: 145


View Profile
« Reply #3 on: July 06, 2017, 01:37:22 AM »

You can disable the submit button like this

$('#button_id').prop('disabled', true);
Logged
akset
Newbie
*
Posts: 1


View Profile
« Reply #4 on: July 13, 2017, 07:37:01 AM »

This is a little hacky, but it's how I did it. I have a bunch of forms that I wanted to force the user to unlock in order to edit (to prevent accidental edits). The gist of it is using jquery.find to loop through a collection of DOM elements with the selector and call a function on them.

This is the function that the form onLoad calls to make sure all the field elements are disabled initially:

Code:
function disableForm(which) {
    var form = $('#' + which + '_Form');
    var btn = $('#' + which + '_Toggle');
    var lock = $('#' + which + '_Locked');
    btn.linkbutton({
        text: 'Unlock <span class="offset-up" uk-icon="icon:lock"></span>'
    });
    lock.val(1);
    form.find('.easyui-textbox').each(function() {
        $(this).textbox('readonly', true);
    });
    form.find('.easyui-combobox').each(function() {
        $(this).combobox('readonly', true)
    });
    form.find('.easyui-datebox').each(function() {
        $(this).datebox('readonly', true)
    });
    form.find('.easyui-numberbox').each(function() {
        $(this).numberbox('readonly', true)
    });
}
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!