Display of text from BB10 Cascades App to the server

How you POST code of your application of Cascades to the server? QHttp or CURL? Samples?

(1) collect the text of the entry fields

2) ?? code

3) post to server

The simplest implementation of what you are looking for:

Creating a connection, ask the object with the addition of the parameters retrieved from textfields and then by calling the PostRequest method

/*!
 * @params mRequestParams a QUrl object used to store the parameters used by MyNetwork object while making post request.
 * @params mEmailTxtFld a reference to TextField control used to store the email address entered by user.
 * @params mPassTxtFld a reference to TextField control used to store the password entered by user.
 */
void App::requestNetwork(QUrl mRequestParams, TextField *mEmailTxtFld, TextField *mPassTxtFld)
{
    if (mEmailTxtFld && mEmailTxtFld->text() != NULL
            && mEmailTxtFld->text().length() > 0)
    {
        qDebug() << "Email value " << mEmailTxtFld->text() << "  \n";
        mRequestParams.addQueryItem("username", mEmailTxtFld->text());
    }
    if (mPassTxtFld && mPassTxtFld->text() != NULL
            && mPassTxtFld->text().length() > 0)
    {
        qDebug() << "Pass value " << mPassTxtFld->text() << "  \n";
        mRequestParams.addQueryItem("password", mPassTxtFld->text());
    }

    try
    {

        /*!
         * @brief this object manages the whole network transaction(starting from request creation to response acceptance).
         */
        QNetworkAccessManager *networkManager = new QNetworkAccessManager(this);
        /*!
         * @brief this QUrl object is used as parameter to QNetworkRequest
         */
        QUrl requestUrl("Your Server Url That Is Accepting Two Parameters");
        /*!
         * @brief this QNetworkRequest object acts as a parameter to the post() method for making request to server.
         */
        QNetworkRequest request(requestUrl);
        request.setHeader(QNetworkRequest::ContentTypeHeader,
                "application/x-www-form-urlencoded");

        if (networkManager)
        {
            /*!
             * @brief this connect() method connects finished() Signal of QNetworkAccessManager object with the requestFinished() slot in this app context.
             */
            bool resFromServer = connect(networkManager,
                    SIGNAL(finished(QNetworkReply*)), this,
                    SLOT(requestFinished(QNetworkReply*)));
            qDebug() << "Connection is success : ? : " << resFromServer;
            Q_ASSERT(resFromServer);
            Q_UNUSED(resFromServer);

            /*!
             * @brief this object accepts the reply from server once request is made.
             */
            QNetworkReply *reply = networkManager->post(request,
                    mRequestParams.encodedQuery());
            if (reply)
            {
                qDebug() << "Reply from server is " << reply;
            }
        }
    }
    catch (bad_alloc& e)
    {
        qDebug() << "Exception : " << e.what() << "\n";
    }
    catch (bad_exception& e)
    {
        qDebug() << "Exception : " << e.what() << "\n";
    }
    catch (...)
    {
        qDebug() << "Unknown Exception Occurred \n";
    }

}

Collection of server response in a slot and handling method

 

/*!
* this SLOT method collects the reply from  server and handles it
*/
void MyNetwork::requestFinished(QNetworkReply *reply)
{
    /*!
     * @brief QString object to be used to store server response
     */
    QString response;

    if (reply)
    {
        if (reply->error() == QNetworkReply::NoError)
        {
            int available = reply->bytesAvailable();
            if (available > 0)
            {
                QByteArray buffer(reply->readAll());
                response = QString(buffer);
            }
            else
                response = "Zero bytes in response";

        }
        else
        {
            int httpStatus = reply->attribute(
                    QNetworkRequest::HttpStatusCodeAttribute).toInt();
            response =
                    "Error and the code is "
                            + reply->attribute(
                                    QNetworkRequest::HttpStatusCodeAttribute).toString()
                            + "  And the Error string is :: "
                            + reply->errorString() + "\n";
        }
        reply->deleteLater();
    }
    else
    {
        response = "Response comes out to be null";
    }

    if ((response.trimmed().isEmpty()))
    {
        response = "Empty Response";
    }
    qDebug() << "Response String is :: " << response << " \n";

    if (!response.isNull())
    {
        // You got response . Do whatever you want to do with it.
    }

}

It will be useful.

 

Tags: BlackBerry Developers

Similar Questions

  • How do I send the email from BB10 webworks app

    I want to have a module in my BB10 WebWorks app that will allow users to compose a message by entering the information in a form, which will then be sent by e-mail to an e-mail address.

    I guess this could be done by using the EmailComposerOptions API, but I don't know how to use it.

    Any help will be appreciated.

    Have you looked at the code example in the API document?

    https://developer.BlackBerry.com/HTML5/APIs/BlackBerry.Invoke.card.html#.invokeEmailComposer

    < script="text/javascript">
    //simply invoke email composer, with no options and callbacks
    blackberry.invoke.card.invokeEmailComposer();
    
    //invoke email composer with subject, body, to, cc and attachment options
    blackberry.invoke.card.invokeEmailComposer({
        subject: "Email subject",
        body: "Email body",
        to: ["[email protected]", "[email protected]"],
        cc: ["[email protected], [email protected]"],
        attachment: ["/path/to/an/attachment.txt", "path/to/another/attachment.txt"]
    }, function (done) {
        console.log(done);
    }, function (cancel) {
        console.log(cancel)
    }, function (invokeError) {
        console.log(invokeError);
    });
    
    

    Once the function is called, map of composer email will slip into the view with all pre-filled fields and the user can then click on send.

  • E-mail from Q10 peripheral blackBerry control the Server - / unread and delete!

    My problem is that my BB Hub seems to have complete control over my web mail server.  In other words, whenever I delete an email in my Inbox BB Hub, it removes the enamel on my server as well.  It is a huge problem for me, with regard to the last ten years, I was in the habit of deleting e-mails on my device once I read them and then to remedy later in my office, where messages were also pulled down by Outlook (or, when I travel, I can go online and see the messages online through my web server directly).  It is more than a mere preference: it is essential to be able to read some emails on a normal sized screen.  The small screen of a phone just doesn't cut it sometimes.

    Another problem I have is that my BB Hub inbox marks all messages as "read", before even that I read them.  And, when I mark not 'read', it makes them pop back up on my server.  It is also more than a minor annoyance: when you get 300-500 emails per day, it's really hard to keep track of what you've read and what you do not have when all of them are marked as 'read '.

    Is it possible to divorce my server online ordering of the Q10?  Put on 'manual' and 'push' sync will not work.

    If you are unable to use Outlook and BB10 and yet messages come not "read" for your device, then that adds a major drawback.  Maybe I'm not fairly warned with Outlook, but I don't think that it will allow you to pull down messages from the server and let them still "no read" on this server.  You can leave a copy of the original message on the server, but you can't leave it in a State "unread".  This will prevent the Z/Q10 have unread messages on its screen (if you use Outlook on your desktop).

    And you're on the dangerous territory to be able to permanently delete the messages from the server, removing them from your device.  The BB has always been an additional tool, not a replacement for the desktop environment.  If I can no longer delete messages I've read the until I'm sure that they have been pulled down from the server and saved by Outlook, this will result in a much more crowded Inbox on a daily basis and so more time it cleaning at the end of each day.  BB was supposed to add for convenience, not diminish it.

    Hello

    BB10 is nothing like inheritance, so expect that it would work as legacy is for the disappointment. Legacy devices used BIS, which provided all the functions you mention. BB10 doesn't use BIS and instead has a client full email on the device, which works the way it is designed.

    It is clear from everything you describe, WAD - works as expected. The mailbox on the device and the server are supposed to now be images of mirror each other... whatever you do one account to another. There is no way to replace it, since it's WAD.

    Workarounds exist using the server folders to move things rather than delete them. Workarounds are heavy, but they are what they are. The design of the device, it's what it is.

    Many hope that future updates can bring some of these features to the BB10 platform, but no one can say if/when this will happen. For now, it is what it is.

    Good luck!

  • How can copy text from a PDF file in the right order?

    I get texts translation of customers in PDF files. I need to copy some of the text of these files in Word, but the selection of Adobe jumps tool documents around, seemingly at random, sort of paragraphs and lines from different locations on a page are automatically selected together. The tables are particularly bad. If I try to copy an entire file, receives yet more random order. For example, all the titles of the document can be gathered in one place. I tried various PDF conversion software. They put all the PDF content in the areas of text, which is not suitable for my purposes. I want to just copy the PDF files in the exact order in which they appear on the page in text form that I can handle in Word. I'm now up to version 9.3.0 and there has been no improvement. Is there a solution to this problem?

    Hey, Marcoola.

    I agree that by copying and sticky from PDF to Word maunally are really difficult and tedious work. I have encounterd this problem before. Fortunately the problem can be solved perfectly now. I recommend AnyBizSoft PDF to Word Converter, which is totally free for months before. This conversion mode supports three app - batch, partial, right-click conversion and it even supports encrypted PDF conversion, previously you must have legal rights. And the conversion quality is superb, all the original text, page, images and hyperlinks will be preserved in an editable word document. It is more useful than those software online for free. It will be useful.

  • How can I transfer files from aol safari app to the mail app?

    People,

    I'm trying to transfer my files from my aol email in safari for my mail app on my Mac Air 13?  What should the steps I'm indoing this?

    Thanks in advance

    AOL provides the documentation here

    https://help.AOL.com/articles/how-do-i-use-other-email-applications-to-send-and-Recevoir-my-AOL-mail

    Excerpt:

    Mail for Mac (Apple)
    Set up your AOL email account or email

    1. launch the Mac Mail using the mail icon on your dock.

    2. click on the menu of messaging in the upper left corner of the screen next to the symbol of the Apple.

    3. click on accounts...

    4. scroll until you see AOL on the right side of the window and click on it.

    5. Enter your AOL email account information in the fields.

    6. click on connect / setting up, depending on which version of Mac OS x you are using.

    7. once the account information has been validated you will be invited to a new window. Select the applications you want activated by placing a check mark in the box next to the application.

    8. click done once, finished activating/deactivating the Apps.

    That's all! Your AOL email account has been set up in the Mac Mail.

  • InDesign does not display a text in documents or fonts on the character Panel

    Captura de pantalla 2016-01-19 12.52.20.png

    When I place text on a document, and then I tried to modify ir, text does not appear, there kinds to disappear; and when I select a text to change the font, the list of installed fonts not displayed either, nor the overview of each font.

    IM an Adobe InDesign CS5.5 running on a mac with Mac OS X El Capitan version 10.11.1

    This is a common complaint with the versions not supported with El Capitan.

    Restore your previous operating system or upgrade to creative cloud.

  • How can I make the text box caption to display a text variable that is longer than the length?

    Hi all, I would like to do this: make a text caption to display a variable that contains a paragraph of text that the user has typed as soon as possible.

    I created the maximum length of the variable only 1000 and I am able to partially displayed variable in the text caption - only at the end of the first line of caption text.

    ICan someone tell me how to configure the text caption so that it can encapsulate texts? I can't find it in the properties panel.

    Thank you very much.

    No need to shout, even if I'm not native English, I understood your question very well, and this can be done with the enhanced TextArea widget as I mentioned. Here is a screenshot:

    Workflow:

    • Create a user variable, I scored it
    • Insert twice the widget with variable TextArea (Jim Leichliter, CaptivatePro), on the screen, these are the two rectangles on the bottom red and blue
    • Configure the first Widget to be associated with v_text and show this variable by inserting a default $$ v_text$ $
    • Configure the second Widget to display this variable by inserting returns a default $$ v_text$ $
    • You will need a button to refresh, so that the text appears in the second widget. Here I used the button, and then assigned to the action "Jump to slide" with the same number of slide so that the playback head rewound to the beginning of the slide
    • The text in the second widget shows; as you can see, it can be formatted as you wish.

    If you want to display the text in another slide, no need to make the action update, it automatically displays when you get to this slide.

    It is not a text caption that is displayed, but the widget. Is this a problem?

    Lilybiri

  • Cannot insert data with the PDO function [from: insert and update of the server in the same shape behaviors]

    I feel as if I'm fighting my way around a paper bag trying to insert a record.  I have recently converted from MySQL for PDP, which cannot be applied.  I'm not trying to write routines to update data and started with insert.  I tried the example in your PHP Solutions edition two, pp. 361-363, but I can't get a written account.

    It is a database, which I supported since the host server using phpMyAdmin.  I'm very well display the data on the site, so I guess that my login script is ok.  However, nothing I've tried has got a registered insert.  I tried to get back to the basics, and it still does not work.  This is my current code.  Something is wrong with my statement = $sql and I can't identify the problem.  Help, please!

    If (isset($_POST['insert'])) {}

    try {}

    create the SQL

    $sql = "INSERT INTO Homepage_text (enriched, h_date, h_seq, h_col, p_heading, p_text, h_hide) VALUES ($_POST ['enriched'], $_POST ['h_date'], $_POST ['h_seq'], $_POST ['h_col'], $_POST ['p_heading'], $_POST ['p_text'], $_POST ['h_hide']);"

    $sainttim-> execute ($sql);

    echo "new record successfully created ';

    }

    catch (PDOException ($e) exception

    {

    echo $sql. "< br / > '. $e-> getMessage();

    }

    }

    There are several things wrong with your code:

    • You use elements of an associative array within a double quoted string. Which will cause a parse error.
    • The values you are trying to insert in the database are for most (if not all) of the text fields. If you use a literal SQL query, text fields must be wrapped in quotes.
    • You try to use the method execute() with a literal SQL query. In AOP, execute() only works with a prepared statement. To run a literal SQL query, you must use the exec() method.
    • Passing the values in the array $_POST directly in the database without any sort of validation and without escaping quotes or other characters just asking for trouble.

    Follow the examples in the book, and use a prepared statement. To address all these issues quickly and easily.

  • ESXi 3.5 Update 4 virtual machines cannot boot from ISO image stored on the server

    Ok

    If I have one of my virtual machines of ESXi configured to use an ISO image sitting on my server ESXi, they cannot boot from this image.  This is after you click "ESC" during startup in order to change the startup CD-ROM.  I have this a known issue, or I'm just doing something wrong?  If I have the vms use an ISO sitting on my desktop (using Infrastructure Client) it works fine.

    Or the answer is even simpler, make sure I connect at power on.

    OK, Yes!  But some of the things we take for granted... haha...

  • InDesign CC layout text from left to right

    A few days ago, I discovered that InDesign CC now supports layout text from left to right using the paragraph/monkey composer world line, change the orientation of the text and using the kachides signs.

    Back to a document today, I was surprised to see that the direction of text option disappeared from the window of a paragraph, as it had the Kashida option from the character window. I have yet the composer online world para/single.

    Can I accidentally disabled these features?

    You have installed the CC application? Its who you shows the applications that you have and if they have to put up-to-date and allows you to synchronize the settings, etc. It is the control center for all things creative Cloud. I have CC on this computer, so I can't send you a screenshot...

  • Display text from readonly with hyperlink

    Hello

    I'm trying to do something that seems simple enough. Unfortunately, it does not work.

    I need to display a text with a hyperlink. The text is something like

    "If you want to do something, click the link', where the text is just plain text and the text 'link' is the hyperlink. I was able to display all of the text as a hyperlink by setting the subtype in the form of url or display text and the < a href > link < /a > in plain text, but this isn't what I want.


    How am I supposed to do?


    Thanls for your help.

    Elizabeth

    Elizabeth wrote:

    I'm trying to do something that seems simple enough. Unfortunately, it does not work.

    I need to display a text with a hyperlink. The text is something like

    "If you want to do something, click on this link", where the text is just plain text and the text 'link' is the hyperlink. I was able to display all of the text as a hyperlink by setting the subtype in the form of url or display text and the link in plain text, but this isn't what I want.

    How am I supposed to do?

    You're supposed to include a lot of information relevant to the question , so we are clear on what you're trying to do and how you're trying to do...

    Assuming you are using APEX 4.2, set the security property to escape special characters of the element display only on No..

  • MAC Photoshop CC 2105 - I am not allowed to copy and paste text from other apps - it gives me an error?

    The copy/paste function does not work - when I copy text from another program and try to paste I have Photoshop - it gives me this error. I run a Danish version.

    I've worked with adobe for 20 years - he is just a normal procedure to copy paste the text.

    The translation is:

    Was able to complete the text of the Insert command when the tray is empty or the content is not valid.

    Skærmbillede 2016-01-20 kl. 08.56.32.png

    Hi Charlotte,.

    Please update your version of Photoshop for more later.

    An update has been rolled out Photoshop CC 2015.1.2 update now available

    Kind regards

    Assani

  • Problems with display of text and images from adobe

    I'm a non-techie has a terrible problem with Adobe Acrobat 8 Professional.  Even my group of office tech support can't fix, and they have reinstalled the program twice.  When I receive PDFs with a picture or a graphic, the image/picture comes through as an opaque grey square.  Sometimes the entire document (same text) comes through as an opaque grey square, with only the border area that appear in white.  If I try to print the document, the gray part prints.  Other people in my office who has received the same document do not have this problem.

    I have encountered this problem after that I used Adobe Acrobat Professional for the first time to 'clean up' a document I had scanned a photocopy.  I changed some settings on Adobe to see if I could get a clean version of the document, and it is perhaps the origin of the problem.

    I would be eternally grateful to anyone who has any advice on how to solve this problem!

    Susanne

    PS I have attached a few screenshots in Word that will help illustrate the problem.

    Try going to edit > Preferences > Page Display > Page content and information and make sure the "Show large images" checkbox is checked.

  • Display of the paragraphs of the text from MySQL database

    Hi all

    I have a small database used to store news articles and post them on a website.  However what is happening, is that the press articles are not displayed with the information in the paragraph which came it.


    When the page is displayed it just displays the text in a block even if I see the carriage returns if I discover the database in phpMyAdmin.

    Can someone help please?

    You have two options:

    • Save your items with embedded HTML (use something like FCKEditor or TinyMCE to add HTML features to your text box on the entry form)
    • Place two new lines between each paragraph in the text entry and use the PHP function nl2br() displaying the output

    Dreamweaver CS4 (and CS3) go insert nl2br() around dynamic text if you double-click the dynamic text object in the server behaviors panel and select Convert - new lines to BRS licences in the menu format. This encapsulates the object dynamic text as follows:

    
    

    nl2br() converts line-break characters in
    .

  • Native SDK 2.0 to BB10/cascades...

    I want to start on the writing of native code.  The only device I currently have is a Playbook, so if I start writing apps stunts I won't be able to try on a real device until the playbook is upgraded to BB10 (probably several months?).

    However, I don't want to waste a lot of time learning and writing difficult code user interface as part of the old since BB10 is just around the corner.

    My question - if I started apps written using SDK 2.0 native, it will be simple enough to convert and re - build these apps under the SDK BB10/Cascades later?  Or I'll lose a lot of time learning and writing code that will be obsolete in the new framework?

    If these are not games, but 'Affairs' apps or something else, where you would buttons standard aspect of system, text fields and so on, then, you cannot do with the NDK now at all the...

    If the application's UI-heavy, and you do not want to use stunts, so your best bet is to work with the new Simulator of BB10 beta for now because it supports Cascades.

    If the application is not UI-heavy, but you do not want to keep as close an app of Cascades operation behind the user interface, and then you talk about Qt and can actually run on the PlayBook even Qt applications now. But not with all the parts of the Cascades. If this is an option, use the NDK with the Qt libraries.

    Also consider attending a day BB10 Jam during the "world tour" http://www.blackberryjamworldtour.com and see if you can get a Dev Alpha to test.

    Moreover, 'several months' seems optimistic... I think you can assume rather not before October at the earliest. If they decide to put all libraries of stunts in 2.1, however, or if there is a beta version of developer of BB10 on the PlayBook before the fall, and then those who could help you. They not have given any indication yet (AFAIK) that they could do.

Maybe you are looking for

  • NUMBERS &amp; hyperlink

    I created a list of projects on the NUMBERS, is it possible to link documents (pdf) located in a different folder on iCloud or office? I use numbers 3.6.2 on mini Mac running El Capitan 10.11.6 TSK

  • Safari volume disappeared

    Watching a while you clip the tube of the missing volume. Turned the volume all the way to the top, but he barely heard while it has not completely disappeared or Cup.  I tried all the stuff I could find in Apple and internet sites. Everyone you have

  • The option to export the songs has been removed in iTunes 12?

    Perhaps my memory is wrong, but I remember being able to add songs from my library (which are all .mp3 files in my computer) to a selection, then right-click the playlist and export these songs in a certain folder in my computer. I want to make this

  • Projects in iPhoto do not share in iCloud

    I have several Apple products and two photos of books - one recently accused Mac book air - mac are shared via the cloud, but not the project (book), I created someone could explain why?

  • Windows XP does not have the files?

    I had security 2012 Windows XP on the computer.  I was finally able to remove the files, but now windows does all the files. I can't launch the restoration or downloaded files.  I can't even open word or outlook.