How to disable button when RadDataForm is not validated? - nativescript-vue

disable the button when form is not validated.
{N} Playground
A similar question was asked before. It says it's solved but what exactly was the decent solution? Did I miss something?
Form validation documentation page is broken it has markdown errors.

Add a #propertyValidated="onValidateForm" event listener that triggers on each validation.
Then you can use hasValidationErrors() on the form to see if the form is valid. The only trick is that is has to be wrapped in a setTimeout(), like so:
onValidateForm(event) {
setTimeout(() => {
this.validated = !event.object.hasValidationErrors();
console.log("form valid: " + this.validated);
}, 100);
}
For a complete solution, see this {N} Playground.

I answered the other question.
I have also updated your playground.

Related

I m inserting my data uthrough page item using request process it gives an error fetch more then one row please give me a solution

var a = $v('P1995_LUMBER');
if ((a = '1')) {
apex.submit({
request: "CREATE",
set: {
LUMBER: "P1995_LUMBER",
LST_NME: "P1995_LST_NME",
FST_NME: "P1995_FST_NME",
},
});
} else if (a != '1') {
apex.submit({
request: "Update",
set: {
LUMBER: "P1995_LUMBER",
LST_NME: "P1995_LST_NME",
FST_NME: "P1995_FST_NME",
},
});
} else {
alert("bang bang");
}
Couple of things:
JavaScript's equality check is either == or === (more details here). (a = '1') assign '1' to the variable.
It seems like you're not using the apex.submit process correctly. Typically, you would set the item's value
e.g.:
apex.page.submit({
request: "SAVE",
set: {
"P1_DEPTNO": 10,
"P1_EMPNO": 5433
}
} );
Although, by looking at your JavaScript code, I would say you don't even need to use JavaScript.
Whenever you submit a page, all items on it are automatically sent to the server-side. You can then reference them using bind variables. You could then simply have two process, one for the Create and one for the Update, each having the corresponding insert/update statement using the different items on your page.
Usually what you will see is a page with two buttons for Create/Edit. They will have a server-side condition so that only the correct one is displayed.
Try creating a Form type page (form with report) using the wizard, and you'll see how everything is done.
Without seeing the page and the code you're using it's hard to tell what your issue really is, more details would be required.
That code does not have any sql in it so it is impossible to diagnose why you are encountering a TOO_MANY_ROWS exception. Run the page in debug mode and check the debug data - it should show you what statement is throwing the exception. If you need more help, post a proper reproducible case, not a single snipped of code without any context.

How to make modal appear on first 2 pages of site visit?

I've been looking around for an answer to this question but all the related questions seem to be seeking to prevent this functionality.
Simply put, how do I make a bootstrap modal appear on the first two pages of a users visit? Right now I have a modal going with some simple cookie script that makes it appear once per visit. Is this something that is possible using cookies or some other method?
Not sure if this is helpful, but this is the cookie code i'm currently using -
jQuery(document).ready(function($) {
setTimeout(function(){
if(!jQuery.cookie('modalShown')) {
jQuery("#myemailmodal").modal('show');
jQuery.cookie('modalShown', true);
}
}, 20000);
you can use sessionStorage and make a counter with it:
$(document).ready(function(){
let counter = sessionStorage.getItem('counter');
counter++;
sessionStorage.setItem('counter',counter);
if ( counter <= 2 )
launchmodal();
})

case-insensitive regular expression in a Google form: is it allowed?

I am using GAS to set some restriction to the string i receive from a textItem added to a form
initialy i have wrote it like that:
var form = FormApp.getActiveForm();
var textItem = form.addTextItem().setTitle('put some integer
followed by A, B or C');
var textValidation = FormApp.createTextValidation()
.setHelpText('wrongPattern')
.requireTextContainsPattern(/(\d+)(a|b|c)/i)
.build();
textItem.setValidation(textValidation);
The idea was to get an integer followed by a,b or c and be case-insensitive.
It does not work and if i check the form editor i see that :look at the screenshot
just changing the pattern,I make it do the drill but with something I don't feel great about
.requireTextContainsPattern('(\\d+)(a|A|b|B|c|C)')
witch give in the form editor: this screenshot
My question is Why does it work ?
Witch rules to follow using:requireTextContainsPattern()?
how to do a case-insensitive pattern ?
Thank to Wiktor Stribiżew here is an other brick added to the questionement.
If i use
.requireTextContainsPattern('(?i)\\d+[abc]')
the editor accept the regular expression as correct,but when you try to submit the form, the answer is not submitted, the button 'SUBMIT' become grey and nothing happen.

Using jsPlumb in an Ember.js Application

I am trying to learn how to use jsPlumb in my Ember.js application so I put a minimal jsFiddle together to demonstrate how they could work together.
In this example so far I just insert the nodes and add them to jsPlumb. I have not added any links between them yet. At this stage the nodes should be draggable but they are not.
Error I get in the browser console:
TypeError: myOffset is null
Which points to this part of the code in jsPlumb:
for (var i = 0; i < inputs.length; i++) {
var _el = _getElementObject(inputs[i]), id = _getId(_el);
p.source = _el;
_updateOffset({ elId : id });
var e = _newEndpoint(p);
_addToList(endpointsByElement, id, e);
var myOffset = offsets[id], myWH = sizes[id];
var anchorLoc = e.anchor.compute( { xy : [ myOffset.left, myOffset.top ], wh : myWH, element : e });
e.paint({ anchorLoc : anchorLoc });
results.push(e);
}
You can see that a simple example without integration with Ember.js works as expected. I know that this version of jsPlumb I have uses jquery-ui to clone elements and support drag and drop. A post here shows there is an issue with jquery-ui draggable functionality in Ember. However, I am not sure if I am hitting the same problem. If that is the same issue I am having, I would appreciate some help in how to implement the solution suggested there in my application. I am new to both Ember and jsPlumb, so I would appreciate clear guidance about what is going on here and what path to take.
How can I make this example work?
Luckily my suspicion was wrong and the issue was not with metamorph. jsPlumb and Ember work just fine together, without any hacks. I put a little example in this jsFiddle that demonstrates how they could work together.
Credit goes to Simon Porritt who helped me at jsPlumb user group to identify the problem. What I was missing was a simple call to jsPlumb.draggable element. However, the above error persisted after this fix.
The particular error message above was result of Ember calling didInsertElement an extra time with an element which did not make it to the DOM. I have reported this issue. One workaround is to check the element makes it into the DOM before calling jsPlumb. As you can see in the jsFiddle I have added this code in the didInsertElement hook to get rid of the error.
elementId = this.get 'elementId'
element = $("#"+elementId)
if element.size() > 0
console.log "added element", element
jsPlumb.addEndpoint element, endpoint
jsPlumb.draggable element
else
console.log "bad element"
Hope this helps someone.

ValueChanging event on Infragistics WebDataGrid

Does anyone have an idea why this doesn't work or a workaround?
I'm trying to use the ValueChanging event from inside an EditorProvider
I have defined an EditProvider
<ig:TextEditorProvider ID="tepPercent">
<EditorControl HorizontalAlign="Right" ClientEvents-ValueChanging="validatePercent4Decimals"></EditorControl>
</ig:TextEditorProvider>
And a javascript handler
function validatePercent4Decimals(sender, args) {
var oldfieldvalue = args.get_oldValue();
var newfieldvalue = args.get_value();
if (isNaN(newfieldvalue)) {
args.set_value(oldfieldvalue);
args.set_cancel(true);
}
}
I've debugged it and can see it is running, and if I enter 34r, the inNan tests true and the set_value and set_cancel are called. But the value on the grid does not change from the 34r...
What's going on?
From this post on the Infragistics forums I believe that you have a numeric column. If this is the case then you should use a NumbericEditorProvider instead. There are more details on the available editor provides in the Infragistics help:
http://help.infragistics.com/NetAdvantage/ASPNET/2011.1?page=WebDataGrid_Editor_Providers.html