WatiN ClickNoWait equivalent for Blur method on TextField - watin

I have some editing that happens on in the onblur event for a text input which creates a pop-up if the field value does not fit the constraint. I know, archaic, but it exists, therefore it must be tested. I test other pop-ups that are created by button clicks using the ClickNoWait method but there does not seem to be a comparable NoWait event that will work with Blur. I tried KeyPressNoWait using (char)9 but no luck (the onblur event doesn't get fired). Any suggestions would be appreciated.

Have you tried executing the java script code to fire a blur?
Browser.Eval("$j--.blur()");
See also:
Unable to fire jQuery change() event on selectlist from WatiN
And:
http://api.jquery.com/blur/

Related

Using bootstrap calendar inside slickgrid then Calendar is stuck issue

I am using bootstrap calendar inside slickgrid. When calendar popup is opened and use Alt+tab or scope out of slickgrid then calendar gets stuck. I have to reload application to get rid of calendar popup. I want to close calendar pop up as soon as user scopes out of slickgrid. Please suggest way to do it.
Not sure if it's your problem but you can't use just a z-index in SlickGrid that won't work and won't do anything, you need to use position: absolute on your Editor (each editor has a args.position passed to their constructor) that you can use to reposition your editor next to the cell that you clicked, however make sure that you also add a position() method that will be called if it exist and of course you need to add proper code to reposition the DOM element inside that method. Also when you click on a different cell then the previous Editor will call the destroy method, so make sure you remove the Editor properly by adding necessary code in your destroy() method.
All of that position usage can be seen in 1 of the built-in Editor which is the LongText defined in the slick.editors.js on this line
The absolute style is applied here
and the position(cellPosition) method is defined here
If your problem is really that your Editor doesn't get removed from the DOM, then it's because you didn't code the destroy() properly and here is the LongText destroy() method for reference. Also you might want to add an onBlur event that will call your destroy() method after a blur or any other event that you choose.
and here's a print screen of the LongText Editor that is repositioned over the cell you clicked and you can test it yourself in this Example - Editing

Text in CKEDITOR field not being submitted in the first submission

The text in ckeditor field is not sent when submitting forms for the first time (only on the second time, third time, etc).
For example, If try to create an article's post and submit the form I'll get a validation error: 'The field body is required'. If try to submit again (for the second time or third time), It will work well.
The real problem is when editing! For example, when editing a form the field 'body', among others fields, is filled out with the data from the database. In other words, there are already text in the ckeditor field.
If I try to submit the form for the first time it will not update the body because the text in the ckeditor is not sent; what is sent is the default value (the old article's body, which was filled out with data from the DB).
Therefore, it won't edit unless I get a validation error in other field (if I get a validation error, I'll have to submit again, and that will work).
How to solve this problem? Is this an known bug in CKEDITOR 4? If I don't solve it the users will feel frustrated if they have to submit the form at least twice to edit or to create an article.
Here is a list of plugins I'm using (may be useful to solve the problem):
a11yhelp, about, api, autocomplete, autocorrect, browser, clipboard, colordialog, copyformatting, crossereference, dialog, div, docprops, find, googlesearch, image, link, liststyle, magicline, mathjax, openlink, pastecode, pastefromword, preview, quicktable, scayt, section, showblocks, sourcedialog, specialchar, table, tableselection, tabletools, tabletoolstoolbar, texttransform, widget, wsc
By the way, I downloaded ckeditor using ckeditor builder in their official website.
I opened this issue in GitHub and a guy figured out the problem. His proposed solution worked wel!! Here is what he said:
Workaround
As the issue is more tricky to fix than it seems, for now I propose a
simple workaround: invoke ajaxRequest not on $( document ).ready,
but rather on editor's loaded event:
CKEDITOR.replace( 'editor', {
on: {
loaded: function() {ajaxRequest();}
}
});
Explanation of the issue
The issue is connected with how DOM listeners are registered for given
element:
The order of event listeners for a particular event type will always
be:
The event listeners registered with addEventListener() before the first time the event handler's value was set to non-null
Then the callback to which it is currently set, if any
Finally, the event listeners registered with addEventListener() after the first time the event handler's value was set to non-null.
In case of CKEditor 4, the value of the form's element is modified by
editor._attachToForm private method, which adds event listener to
form's submit event:
ckeditor-dev/core/editor.js form.on( 'submit', onSubmit );
However this listener is added on loaded event, which is fired
asynchronously when editor is loaded – so after registering
synchronous onsubmit handler with the validation logic. This way
editor's field is updated after validating.
Proposed solutions
Update editor's element on formdata event. This way we would have
total control over data being submitted and we would be sure that
correct data is set before submit event. The problem with this
solution is the fact that browsers' support is non-existent; the event
will appear in Chrome 77, however it is still not known if and when
the support will appear in Firefox or Safari.
Update editor's element on every change in the editor's content thanks
to change event. This solution will also fix cases, where some other
scripts are using value not from the editor, but directly from the
replaced textarea – they would get fresh data more often then only
after submitting the form. However this solution requires #1364, which
connects with a pretty big refactoring.
NOTE: AjaxRequest is the function I was using to submit the form togehter with Jquery.

How to access the cancel button event in jQGrid Edit dialog box

Is there an event associated with the cancel button of various jQGrid dialog boxes like ADD, Edit and Delete ? For my edit dialog box, I need to do some processing when the user clicks the cancel button.
please help
thanks
Probably it could be enough to use onClose callback for form editing (see the documentation here and here).
If you would fund out that the callback are called not allays (I don't tested it in the current version of jqGrid) then you can choose another way. If you really need to process all closing of all dialogs you can consider to overwrite or to subclass $.jgrid.closeModal or $.jgrid.hideModal functions. See the demo from the answer (compare the code with original one here).

Jqgrid Edit Form Change Event of Select doesnt fire when scrolling thorugh records

I have been following this example, http://www.ok-soft-gmbh.com/jqGrid/DependendSelects2.htm, as it is just what I need. I have got it working but it doesnt work when scrolling through records. If you bring up the form and scroll from a UK record to a US record, the list doesnt change. The onChange event only fires when the user selects from the select drop down.
Is there a way around this?
Thanks for your help.
James
My old demo uses 'change' event handler defined in the dataEvents property of the editoptions. In the dataEvents array one can define other event handlers.
You need just bind keyup to the column exactly like it's described in the answer. In the body of the event handler you can do the same actions as in the body of the 'change' event handler (you can place the code in a function and call it from the both handlers). In the way you should be able to solve the problem.
UPDATED: I updated the old answer and another one which was origin for the demo which you used. The new demo support the navigation buttons (the buttons to edit the 'next' or the 'previous' row) in the editing form.

VB6 sending keypress to a textbox

Hey all, i am looking for a way to send a keypress letter/number to a textbox. The reason why i need this is that this textbox is a AutoComplete box that, when the user types, it displays a list of suggestions like google does.
However, for it to work, the user has to click in the box and type something. I can send any number/letter to the box i want using this code:
Private Sub Command_Click()
AutoComplete1.Text = "g"
End Sub
And it does put it into the textbox but it does not trigger the autocomplete list (the list has words like "good","great","pop","test"). Only when i click in the textbox and type "g" is the only time i get the "good","great" suggestions.
Is there a way to trigger this with the code i posted above?
Thanks!
David
Wouldn't
AutoComplete1.SetFocus()
SendKeys("g")
do that?
How about putting the code in the Key_Press event of the textbox instead of click event of the command button?
My guess would be to use Keyup event and fire the code that displays the list of suggestion if it isn't fired by the Keyup event itself

Resources