views:

86

answers:

3

Hi, my application updated some of the framework as well as jquery and now doesn't work. I'm not sure what to do since I'm not getting useful information back to debug. Here's what I am looking for:

GIVEN: I am on the selected page with a text field and submit button WHEN: I type a few letters in the textbox THEN: I want Autocomplete with available accounts matching values from the database.

GIVEN: I see a value that I want to add to my list WHEN: I click "Add" THEN: I want to see the selected value displayed in the panel via Ajax (no need to refresh the page):

Here is the code for the Autocompletion:

    $this->btnAddOffer = new QButton($this->pnlAddOffer,"btnAddOffer");

    $this->btnAddOffer->CssClass =  "button";

    $this->btnAddOffer->Text = "Add";
    $this->txtNewOffer->AddAction(new QEnterKeyEvent(), new QAjaxAction('btnAddOffer_Click'));
    $this->txtNewOffer->AddAction(new QEnterKeyEvent(), new QTerminateAction());

    $this->btnAddOffer->AddAction(new QClickEvent(), new QAjaxAction('btnAddOffer_Click'));

and:

protected function btnAddOffer_Click($strFormId, $strControlId, $strParameter) {
    if($this->txtNewOffer->Text == ''){

        $this->txtNewOffer->Warning = "You must be enter a offer company name!";
        return false;

    }
    $objUser = unserialize($_SESSION['User']);

    $objAccount = Account::LoadByName($this->txtNewOffer->Text);

    if($objAccount){
        $objUser->AccountId = $objAccount->Id;
        $objOffer = Offer::LoadByUserOwnerIdAccountId($objUser->Id,$objAccount->Id);
        if($objOffer){

            QApplication::DisplayAlert("This account already exists!!");

        } else {

            $objOffer = new Offer();
            $objOffer->UserOwnerId = $objUser->Id;
            $objOffer->AccountId = $objAccount->Id;
            $objOffer->Save();

            #QApplication::DisplayAlert("New account was added successfully");
        }
    }

The current outcomes that I get:

  • When I type in the textbox, I see an empty form with the following Firebug:

alt text

I'm not sure what to do since I have no information to debug what is going on.

Here is a screenshot using Firebug of the code-generated around the input box and the submit button:

alt text

The related code in the controller:

More details can be found here:

http://github.com/allyforce/AF-upload/blob/master/Library/Offer.class.php

A: 

Do you have any javascript or CSS that might be hiding the id "btnAddOffer_ctl". That would be the first thing I'd search for. In the source do a find for the string *bntAddOffer_ctl*. Chances this id either has its visibility CSS set to hidden.

You could also have a JavaScript section that might look like this:

document.getElementByid('btnAddOffer_ctl').style.visibility = 'hidden'; 

or

document.btnAddOffer_ctl.visibility = 'hidden'; 

Hope that helps.

Louis Simonetti
let me check it out
Angela
I could be wrong, but I think the issue is that the event attached to the button is not firing, rather than the button not displaying
Rob Cowell
Yes, Rob, you're eright, it is because the event on the button is not firing....!
Angela
A: 

Change the button type to submit instead of "button" (or be sure whatever action assigned to "button" does what you want it to do- because we can't see what the function is supposed to invoke with this picture)

Ryan
+1  A: 

Have you defined a method for the event to call. Looking at your screenshot, you're using a QAjaxAction rather than a QServerAction, but have you told it the method to call, for example :-

$this->btnAddOffer->AddAction(new QClickEvent(), new QAjaxAction('btnAddOffer_click'));

and then

protected function btnAddOffer_click()
{
    // submit code you want here
}
Rob Cowell
Ah, one of the two people in the universe who uses QCodo! Awesome, thanks. I will put my code above
Angela
Think we got it..thanks! Do you still use QCodo as a primary framework or do you use something else as an option or alternative? Thanks!
Angela
Still use it when I'm doing PHP stuff, but I'm primarily a .Net developer. PHP is my sideline ;-)
Rob Cowell