Dear All,
I want to add behavior of table Add button, if all requirement fields <> null then table Add button will enable and if all field empty (null) then table add button will disable
How to Enable/Disable Table Add Button ?
Regards
Juned
How to Enable/Disable Table Add Button ?
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 35
- Joined: Mon Jul 14, 2014 11:55 pm
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Juned,
You can do this using jQuery, something like this:
1. Use Html Element Properties to apply a class to all the input fields (Editor Input tab!) that you want to check, ("check1" in the following code).
2. Similarly apply an id to the button you want to enable/disable ("mybutton" in the following code).
3. Then add this code to the ready event of one of the controls higher on the page - in my example I added this to the Panel Control which contains the fields and the button:
This example is based on simple input fields with a button. You might have to amend this a bit if you are using tables.
Regards
Jon
You can do this using jQuery, something like this:
1. Use Html Element Properties to apply a class to all the input fields (Editor Input tab!) that you want to check, ("check1" in the following code).
2. Similarly apply an id to the button you want to enable/disable ("mybutton" in the following code).
3. Then add this code to the ready event of one of the controls higher on the page - in my example I added this to the Panel Control which contains the fields and the button:
Code: Select all
// Disable button initially
$("#mybutton").prop( "disabled", true );
// Bind the validateInput function to key presses of our input fields
$( ".check1" ).bind( "keyup", function()
{
validateInput();
});
function validateInput()
{
var allOk = true;
$( ".check1" ).each(function()
{
var v = $(this).val();
if (v == null || v.length == 0)
{
allOk = false;
}
});
$("#mybutton").prop( "disabled", !allOk );
}
Regards
Jon
0 x
-
- Ebase User
- Posts: 35
- Joined: Mon Jul 14, 2014 11:55 pm
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
You can add an id to the add row button by selecting the table, then right click and select Html Element Properties, then select the Add Row Button tab. Alternatively don't use the Ebase add row button, just add your own button above or below the table. I think you will find the task difficult with a table as the CSS class will be applied to all rows and therefore you will be checking all rows for null values - this might be what you want.
The alternative of course is just to make all the table columns mandatory then Ebase will issue a message if a required value is missing.
Regards
Jon
The alternative of course is just to make all the table columns mandatory then Ebase will issue a message if a required value is missing.
Regards
Jon
0 x
-
- Ebase User
- Posts: 35
- Joined: Mon Jul 14, 2014 11:55 pm
Who is online
Users browsing this forum: No registered users and 7 guests