Tweet button with dynamic text and events - twitter

I want to have an input field in my page and a button so that the user can manually enter the tweet text and then when he its the submit button, the actual twitter status submit will open with the text the user entered.
moreover, I also want to get a callback when a user submit the tweet on twitter like Web Intents Javascript Events
as far as I know there are 2 ways to do that:
re-render the tweet button after every change of the input using twttr.widgets.load();, something like this example, only instead of the update button use the onchange event of the input. the problem is when the tweet button is re-rendered its disappears for a moment.
the next option is not to use the twitter button, instead when the user hits submit open a new window and redirect to https://twitter.com/share with the tweet text as the query param (like twitter suggest in Build Your Own Tweet Button). the problem with this solution is that I dont get an event when the user submit the tweet on twitter.
Any ideas how I can combine both requirements, dynamically change the tweet text & getting an event on tweet submit?

Not sure if this would work, but my first thought is to use the tweet button, and add an invisible div over it which will capture the user's click, reload the widget with the user's text, and trigger a click on the widget 250ms later (or however long it might take it to reload on a slow device). You'll only get one flicker, so it wouldn't look smooth, but it wouldn't look like a bug either.

Related

How to get textfield value in App Inventor without form submission?

I want to know the event in blocks section using which the entered text value can be obtained without a form submission through button.
Let's say user inputs text in mobile phone through keyboard and presses enter. In this case I want some event to trigger and get the value that user entered.
There are 2 events available like lostfocus and gotfocus.
Will these work? Or is there any other good approach for getting text value on pressing enter?
Unfortunately there is no such event like OnEnterPressed available in MIT App Inventor and the events LostFocus and GotFocus will not work in this case.
What you currently can do is
use a button and use the Button.Click event, or
create your own custom keyboard, see also this example
Currently there is a limitation for App Inventor extensions, which only can be used for non-visible components. Later as soon as also visible components are doable, then you could write your own textbox extension and add an event yourself.
Edit concerning the new question in the comments about different screens:
Use different screens wisely
Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantages, because in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed...
You can insert a Clock component that monitors the TextBox1.Text. When it triggers, it checks if the TextBox1.Text has changed and saves it to a variable. When it triggers again, it compares the variable with TextBox1.Text. After the user finishes typing, the variable and TextBox1.Text will be equal and then you can trigger the event like you eanted when the user pressed Enter.
Hope this helps!

How to send ENTER key in protractor tests on iOS?

I'm using ProtractorJS (and Appium) to test a website on browsers and devices. One of the tests is to type some text in the search box and then hit ENTER. Here is the snippet from the page object.
page.searchInput.sendKeys("Text");
page.searchInput.sendKeys(protractor.Key.ENTER);
The above two lines work fine on any browser and Android devices. However, the same test fails on iOS because the ENTER key is not sent. In the iOS keyboard the key I have to press is the "Search" one.
The test must trigger the search using the keyboard.
Any ideas on how to send the ENTER key on iOS?
If there is no button on the page, Safari will be stubborn about it and not submit the form. In general, I use the button tag instead of the input tag and have better results, but either way unless there is a submit button on the page, and that button is visible (see this question for reference: How to submit a form when the return key is pressed?), Safari will stubbornly refuse to submit the page. In this case, I would put a submit button on the page even though most users will never use it on mobile. You may have fits getting it past your design department. The other option is to use a blur event and trigger it that way.
You can send just new line symbol \n or create tap by coordinate proportions at the right lower corner of the app.

Replaying page on iOS app

I am making an iOS app through xcode for audits where each room in a building uses the same page format but has different information. How can I replay the same page over through an add bar button so that when the add button is pressed the same page comes up but with all the text fields empty.
I assume when you are done putting in the information, you must be saving the information in the local DB or any server may be.
What you can do is, once you are done with putting in all the information display an alert stating that the information is saved and upon the clicking on any button on the alert, clear all the fields.

How can I capture text input dialogue in a tex input popup box on iPhone? i.e. name and email

In my app, when the user taps a button a number will decrease until it hits zero. When the number hits zero I want to display an input popup box for the user to put their name and email. I then want to be able to capture this information, as the developer, so that I can then be able to contact the user of my app. Thanks for the help!
A quick suggestion:
The decrease of Number you can do in the IBAction method of that button where you getting call on every hit on button. You can keep the count in a variable and keep on change the text of label accordingly.
When Count becomes 0, you can get the help from this library to show a popUp view for input.
PopUp from CocoaControls -- Click here
You may need to customize the library according to your requirement.
Happy coding.

How do I implement a flagging functionality which displays icon next to an item in?

I want the add the ability to flag responses to a question in a web app? There would be "flag this response" next to each response. When the div is clicked an "X" icon (indicating its flagged) is placed next to the response and the div now says "Unflag this response". To remove the flag, click the div again (a toggle effect).
Is there widget that already exist that works for mvc? How do I get started?

Resources