UIActionCheckRequiredFields into a modal

#1

Into a modal I want to check if some fields are set before to allow the create inspection button to be clickable so I’m using this code - when I start to type something in the form the anyway looks like that nothing happen and the UIActionCheckRequiredFields is not even invoked. Looks like the query is not listening to the batchLabel - do you have any insight on this?

            {
                "query": "batchLabel",
                "trigger": "change",
                "action": {
                    "type": "UIActionCheckRequiredFields",
                    "requiredFields": [
                        "batchLabel"
                    ],
                    "elementsToToggle": [
                        "[data-action='createInspection']"
                    ]
                }
            }

this part is into the .c3ml

 <div class="form-group">
                        <label class="col-xs-3 control-label">{{ batchLabelText }}</label>
                        <div class="col-xs-8">
                            <input class="form-control" name="batchLabel" type="text" field="batch.label"/>
                        </div>
                    </div>
0 Likes

#2

try "query": "input[name='batchLabel']" ?

0 Likes

#3

Thanks @sean.summers I have just tried but it does not work - I have set a debug at first row of dispatch function of UIActionCheckRequiredFields and nothing happens

I wonder if I have to add something into the InspectionModal.c3ui to make it work

0 Likes

#4

@marcosordi For behavior query values, you need to provide either a metadata path or a jQuery selector. Since the input you provided is created manually in a template (rather than via metadata), you should use a jQuery selector.

To use a jQuery selector for the query in a behavior, prefix the selector with $, e.g.:

"query": "$ input[name='batchLabel']"
0 Likes