What are the different event handlers got for fb-send button - facebook

I am trying to use fb-javascriptSDK.
At some place i need to show a send button - to send a message to fb friends from within the website.
<div class="fb-send" data-href="http://www.example.com"></div>
Here I have few questions:
1) How to pre-fill the message text-area with some content, by default? (I wanted to put some html content)
2) currently if i include the above html, the f-send button is created and if user clicks on that button, a popup is coming. But can i have an event when the user first clicks on f-send button? ( NOT the "send" submit button inside the popup )
3) With FB.Event.Subscribe - message.send, I have an event handler after the message has been posted. But is there a way to attach an event before posting the message?
Please clarify my doubts...
Regards,
SuryaPavan

No event is triggered until the message is sent
You cannot prefill the message text.
You cannot use HTML in the message text

Related

How can I show a "please wait" message while submitting (logging in)

I use an to show a message while running some code via a JsonRpcService. Works like a charm.
Now, I would like show a similar message saying "Please wait..." when the user submits a page. In this particular case it is logging in - where I need to read a lot of data to show the user. I submit the login info in a custom control when the user presses the icon (=button):
<xp:image url="/arrowGrey.png" id="submitButton" styleClass="submitButton" alt="Login" title="Login">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:Logon.submit()}]]></xp:this.action>
<xp:this.onStart><![CDATA[console.log('Start login');
setTimeout(function () {
XSP.openDialog('#{id:working}');
}, 300);]]></xp:this.onStart>
</xp:eventHandler>
</xp:image>
Logon is a managed bean. However, I never see the dialog box... - nor the "Start login" message?
The definition of the is:
<xe:dialog id="working" styleClass="inProgress">
<xp:div>
<xp:text escape="true" id="computedField1" tagName="h2" value="Logging in. Please wait..."></xp:text>
</xp:div>
</xe:dialog>
Any ideas as to how to obtain this?
The obvious next challenge is to close the dialog should the Logon.submit() fail validation and keep the user on the current page... :-)
If you are doing a Full refresh then the standby widget will not work. it only works on partial refreshes because a full refresh will reload everything on the page. But the standby widget is using a standard Dojo function that you could use.
Or what I usually do when I have some of code that needs to be executed. I send the users to a "please wait XPage" with an animated gif.
The trick is that the code can't start executing before the page and the gif is loaded so I add the code to a hidden button and in the onload event I click this button using client side JS that executed the backend code.
And when I'm done processing, I send them to the right page using context.reloadPage
This works very well.
Fredrik Norling created the very cool "Standby Custom Control" (http://openntf.org/XSnippets.nsf/snippet.xsp?id=standby-dialog-custom-control). It doesn't show a message but a spinning wait icon on every partial refresh that might endure longer as 200ms (you can tweak this down or up if you want to).

How to send sms, detecting text in textview?

I want that when user clicks on certain text,(like call, sms, mail), then corresponding activity should happen ie, when user clicks on call then an action sheet should appear with actions whether you want to save or call etc, similarly for sms and mail.I used textview and gave detection for numbers and email. So for call and mail it is working fine. But how to detect for sms?Because when I give number detection it will automatically show call action sheet ie save or call or cancel.But I want following action sheet, which sms, open, copy, cancel:
I tried using sms//"91123456", but it is not working. I know I can directly launch message picker but do not want this, I want to show default action sheet.I tried this in html and it is working but I want to do in native.
Did you try textView.dataDetectorTypes = UIDataDetectorTypeAll;?
For more data detector types see this UIKit Data Types Reference.

nyroModal v2: How to validate form opened in iframe?

I'm trying to figure out how to validate a form opened using nyroModal.
The page is being opened as below on click of a button:
$(function() {
$('.btnedit').click(function() {
$.nmManual('form_page.php);
});
});
On the form that opens up, I have a few fields that are mandatory and a cancel & submit button.
<a class="nyroModalClose button" href="#" id="btn_submit">Submit</a>
On clicking of the submit button, I want to make sure the mandatory fields have value. If no, an error message should be displayed & the modal window should not close.
I'm trying to use the jquery validation plugin, but without success. The modal window always closes irrespective of the validation scripts.
I haven't found much info regarding form validation in a modal window. Is this not a preferred approach?
Thanks in advance.
I'm not able to help you about the jquery validation plugin in a modal window, but I know that using the instruction $.nmManual in that way, the form will not be placed inside the iframe tag, and if I remember correctly the content of new page will be added without header and body tags, so in a word incorrectly. I guess this can produce no validation.
To successfully open an iframe you need to use filters as described here:
Open iframe manually in nyroModal?
I hope this can help you.

MVC submit form to different controllers

Is it possible to post the same form to different controllers?
Each page could be post only to form action url, but may be some how i may say to button to which url form should go?
e.g i have one form and two submit buttons, one button will post form to one controller/url (eg /action/view) anther button submit form to one to another controller/url (eg /action/anothervew).
You can definitely do this, use JQuery (or just javascript) to attach a function to the onclick event of the button(s). Then use that function to change the URL that the form posts to and then submit the form.
JQuery would be something like:
$('#button1').onclick(function(){ $(this).action = url1; $(document).submit();});
$('#button2').onclick(function(){ $(this).action = url2; $(document).submit();});
You will need to use javascript for this. When the button is clicked have the javascript modify the form's action property to the appropriate controller and then submit the form.
We've done this before using javascript, as mentioned in other answers, and that's probably the correct way to go. An alternative, however, is to post to a single controller method which contains logic to decide where to send the form data off to.
Effectively, you submit the form to the controller, and the resubmit that data based on the text or id of the button clicked using an if statement in the body of the controller action.

MFMailComposeViewController and cancelling "save" action sheet?

i am using MFMailComposeViewController inside my iphone app. I notice that if i enter any text in the body and then press the cancel button, i am prompted with an action sheet with an option to save/don't save the unsent message. I have two questions:
can I programmatically prevent the "save/don't save action sheet from appearing? MFMailComposeViewControllerDelegate doesn't appear to have anything along those lines
if i do save, where is the mail saved to? i looked in my mail accounts and didn't see anything saved in any of the "draft" folders.
No, you can't avoid the action sheet appearing. It's been added in iOS 4.x to, precisely, avoid tapping on the "Cancel" button inadvertently when writing a long email, which I think it's a good idea.
It is saved in "Drafts" folder of the account used to compose the e-mail (normally, your "default account" as it is registered in the Settings of your device). I've just tried using a couple of apps and it works.