First I have created UI as shown below using HTML and Javascript
I am loading this on webView using UIWebView Class.
My Requirement : In the above image when I enter first letter in first textBox then cursor has to move to next textBox automatically.
Now I am getting keyboard Up when I click on each textBox, but it is not jumping to next textBox automatically.
I know that I have to use becomeFirstResponder and resignFirstResponder for this, But I am unable to get UITextField instance when I send the request from HTML when I enter each character.
Please help on this.
If you're using a UIWebView, it would make much more sense to make your Javascript code jump between the fields, instead of trying to do it from your iOS project.
You could check for a keyDown with either regular Javascript or jQuery if you're looking for some easier methods, and then use focus() to move to the next input in your HTML.
Related
This is how I'm currently sending input :
elemnt = self.browser.find_element_by_xpath(xpath="//somexpath")
elemnt.send_keys(tokenId)
Is there a way to do it with executing a javascript that will basically type an input for a given xpath ?
I need this because the website I'm testing has an odd behavior when using send_keys() to type something, when the text is done typing, a loading circle appears and for some reason it goes to the next page after a search(which should be done by pressing continue)
Manually, I managed to reproduce the issue with typing a text, the loading circle appears, and if I press enter while the loading circle is still searching it moves to the next page (there is a continue button that does that when it's pressed)
So my thinking here is that send_keys() might have some weird key press that causes the bug to reoccure, and i would like to replace it with some javascript if its possible that types an input for a specific XPath.
Solved it like this :
self.browser.execute_script("arguments[0].setAttribute('value', 'some value');", self.browser.find_element_by_xpath("//input[#placeholder='Introdu TOKEN']"))
I'm using the ck-editor(4.4.6). In Ck-editor's textarea I want to update my text, for that I use setData("hai"); that text updating correctly but some plugin functionality not working after use this setData(); (eg. restrict multiple enter if I reload the page it's working correctly).
editorInstance.setData("test text");
Anyway first time and after reload the page it working fine.
ruby on rails with jquery things are I'm using.
How can I solve this?
I don't know about ck-editor(4.4.6) but i can give you a way to solve it. You have to use based on your parent class. First time it works because it was same but after that it did't find the class/your specific term/attribute. So you have to use by calling parent class/id and under your activity.
You will need to call the update element function after setting the data, this will actually set the value in the field.
And, also you will need to specify the id of the textarea as given below.
CKEDITOR.instances.id_of_textarea.setData('hai');
CKEDITOR.instances.id_of_textarea.updateElement();
Finally, I got the answer instead of set data I just add my content to CKEditor text area as link this its working fine:
$('#cke_editor1 iframe').contents().find('body').html("Your text");
in my web application some of screen completely deal with Js framework we are doing Automation with QTP plz help me on below issue,
Visualy weblist box if I click in that Edit box will activiate but it's completely Readonly+Non Editable if we click Dropdown Icon it will populate one window in their Tree type value(Ex:Class>>Branch>>Section) we need click Section and then press Set Button then selected values populating in the Edit box.
even though if i'm making Editbox property Readonly is false after entering the values in the edit box clicking submit button it's giving error Null value in that Edit box ?all these are developers completely written in Javascript Framework so is there way to directly entering values with out selecting Popup window values by using QTP(VBSCRIPT) or Javascript code?
Thanks
I don't exactly understand your question but it seems to me that one of the options you're asking about is how to run JavaScript code from QTP. You can do this starting with QTP11 using Page.RunScript (or Frame.RunScript).
I'm building a nested form in rails 3.1 and instead of pressing the "add" button i want to automaticly add an input field when typing text in an empty input field (just like making a question in facebook and adding poll options). But i also want to only add a field if there are characters typed in the field if the characters are removed the extra field should also be removed.
I am working with rails 3.1 and so jQuery and jquery-rails are included in my gem, i don't know coffee script yet.
it's really easy.
Just tap into the focus() event handler and add textboxes as you go along.
I have created a simple demo for you here: http://jsfiddle.net/mcVnN/
Warning: clicking any textbox will add a new textbox here. If you want to add new textbox ONLY on last textbox focus, just compare the id.
If you have any doubts let me know.
Cheers
--
Sorry, did not read your full question, my mistake.
I have put together some quick code http://jsfiddle.net/mcVnN/12/ again on jsfiddle, but you might want to change it to suit your needs.
I was going through my answers a now and realized I had left you in the middle of nowhere.
Took some time to completely re-write my answer - the above answer is a lot buggier, you are better off using the :last selector than manually trying to keep track of the last text box yourself.
See my rewrite here: http://jsfiddle.net/mcVnN/29/
I have also added a max text box count that you can change easily to configure how many textbox you want users to be able to add.
Please replace the above code with this one, if you are using the above one at all.
Thanks.
This is a 2 part question:
1)
click on one of the demo dropdowns on this page. when you tab over to the next input, the text is selected/highlighted in firefox. how can i prevent this from happening?
2) bonus: can you review my code that is hosted on google and tell me what i can improve?
Well, that is just default behavior on Firefox. A possible workaround is to have the input fields execute a JavaScript or jQuery function on select, have the function blur the field (which would deselect the text) and then refocus on the field. Very basic and I'm sure it'd need a couple extra hacks. Unfortunately without scripting, no there is nothing you can do to prevent that.
I honestly recommend that you leave it alone. That functionality was put in place so you wouldn't have to use your mouse when typing into forms, hitting tab would select all the text so you can easily retype it or hit the right arrow key to go to the end of the field. Removing the functionality will only irritate some of your visitors. If they're using the tab key to get to the next field, they probably want that functionality.