I love the documentation of the working version. So often I’ll be researching something on here, find a thread that looks applicable and it just ends somewhere in the middle with no documented resolution.
I want to check each field for values before running my custom action. I tried detecting the missing values in the action, but that didn’t work. I am not back to stacking up condition widgets in my button click event. The conditions are tricky to work with. Each condition says something like this:
‘{Transview.myPartNum}’ !== ‘undefined’ && ‘{Transview.myPartNum}’ !==‘’
On true check the next condition. If they are all true (all valid values) then continue with the custom action. If any one of the conditions is false, then pop a dialog telling the user to go fill all the fields.\
I am having trouble connecting multiple conditions. Is there a better way to do checking for blanks in my input fields? This stacking of conditions approach seems wrong.
You could create a data rule for the button. You’ll have to give your button a binding. TransView.mybutton would work, then put all of your conditions into the rule and as the action disable the button based on the conditions. I think the action will have to be disable, so you’ll have to setup your conditions accordingly.
Good morning,
I am working through the data rule, but I don’t know how to set the button to disabled. I named the button btnAddRow, the epbinding is Transview.btnAddRow. This is my checkblanks data rule just looking at part number for now to test. I will add the other fields once I get this part. I also tried the “Disable” action but it wants a column or a row. My button is neither a column or a row, right? I have tried various values for checking for blanks, from an empty field to the word null and empty quotes.
Looks like I used Disable Columns and then just the field name under column. The dataview for the action is set at the top.
What did you use to tell if the field is empty?
Just leave the final “value” field empty:
If I understand the data rules you gave me, this should disable the AddRow button if the part number field is blank. The disabled status of the button never changes, regardless of the value in the part number field. Did I miss something?
If Hannah’s null version doesn’t work I’d try being a little more explicit by setting Transview.myPartNum to 0 in your onLoad event and then putting 0 in the value of your rule condition.
I have a lot of fields so it’s a combination of the nullValue and specific values, but all of my conditions are on fields in the dataview that exist in the database, not transview fields that are being created on the fly.
Did you initialize your TransView.myPartNum field?
When playing with the setup in your screenshot, the button is not initially disabled until I put something in the textbox and back it out (because I, specifically, did not initialize mine).
I dont think I did initialize those fields specifically. In my Window_OnLoad I am using RowAdd (Transview) and then EventNext (dvOJI_Get). Should I initialize the fields in the same onload event?
Couldn’t hurt to try.
My buttons are in a panel header. I can’t seem to get any rule to disable the button.
I went back and set the rule to look for 0 (also tried “0”) in the part number. Then I initialized the part number fields as 0 in onLoad.
When you preview, what is showing in the transview dataview and in the rules using the dev tools?
In the data rule, when I enter the Data View as Transview, then look at the Field list, there is nothing listed in there. Should myPartNum field already be listed in there? Does that point to a reason why the rule fails? Do I have to somehow initialize the button to Transview (other than just setting the EpBinding to Transview.myPartNum)?
I guess I needed single quotes around my 0 in the value:
This seems to be working now! Yay!! Thank you all for your help. I am sure I will be back with more issues in a few minutes!
