(Solved))The result could not be loaded-jquery-select2 - jquery-select2

I’ve got a problem.
The select box of “Job No.#” can render data from MySQL, but the select box of “Address” cannot.
Field “address” and field “job_number” come from the same table.
But if I create a new field, like “newAddress”, with the same data as in “address”, it works~,
But just changing the “address” to “newAddress” doesn’t work.
In addition to the “address” field, several other fields in this table cannot be rendered either.
The database structure should be ok~ because I am able to fetch() and print the data from the “address” with the same SQL sentence.
And it is working all right on other tables~
Could you please? Thank you very much!

I've solved it!
The reason is a kind of “-” symbol input by users before.
The "-" is longer than normal -.
json_encode() cannot encode it, and it is displayed as garbled code when I print it out directly.

Related

Looking to fill out most or all of the Fed Ex "Create Label" page using URL query string

Looking to create a shipment on www.fedex.com
But fill out most of the fields using a query string at the end of a URL.
Seems like this might not be possible, but need help figuring out how to know whether it is or not.
My "Create Labels" page has a URL ending in -- ?method=doInitialize&utype=null ,
or else sometimes ...
-- ?method=doEntry&link=1&locale=en_US&urlparams=us&sType=F
so it seems promising. Just not sure how to access the names of the required fields (Contact name, Address 1 and 2, etc ) besides guess and check.
Thanks!
--------- Destination Section Parameters Found
The query string parameters for the destination contact field are, at the time this answer was written :
toData.addressData.contactName
toData.addressData.addressLine1
toData.addressData.addressLine2
toData.addressData.zipPostalCode
toData.addressData.city
toData.addressData.stateProvinceCode
toData.addressData.phoneNumber
psdData.mpsRowDataList[0].weight
Of course, they need to be appended to the original URL using valid query string syntax and URL encoding.
--------- How Were These Found ?
These were each found using the page inspector. I found that it is important to cut through the noise by zeroing in on the exact field where the data needs to be entered, and opening up the page inspector to that location.
Right click (Win) or control click (Mac) > "inspect"
This will bring up the following text in the inspector. By trial and error, I discovered that the "name" fields correspond to the working query string parameters.
The part we are looking for :
This corresponds to the query string parameter ...
toData.addressData.addressLine1
... originally listed above.
--------- Unsolved Parameters
It's a mystery why this same rule doesn't apply in the same way to other values in the page, like service type (e.g. "Priority Overnight") or package type (e.g. "FedEx Box"). The following, for example, do not fill as expected, even when using the exact same "name" field from the page inspector.
psdData.mpsRowDataList[0].carriageValue
psdData.serviceType
psdData.packageType
billingData.referenceData.yourReference
Maybe it's a URL encoding issue? Anyway, hope this helps.

Access 2010 form not displaying query

I'm sure this is an easy fix but I can't seem to find it. I just have a form, that will be a subform of another, that needs to display the results of a query.
The query is simple enough, just displays all fields of records that fall between specified dates. The query works great, but when I attach it to the form as its record source it doesn't display the data. I can see the correct amount of record selectors so I know its understanding the query but its as if all fields are hidden!
I have also tried building a query to the forms record source that was simply Select query.* From query. Oddly I have had this working before but I had to specify every field. What I mean is:
Select title From query
Select type From query
Select date From query
...
And so on for all the fields but this seems foolish, can anyone think of what I may be doing wrong?
Thanks in advance!
Edit, forgot to mention I also tried the foolish solution that I mentioned above and it didn't work so its definitely some issue that I'm not seeing, some property that's probably not appropriately set
#sshekhar well its not really code at the moment I'm using Access 2010. I have a form that needs to display a subform that executes this query of displaying records that have a data field that fall between dates specified by the user. The query works and displays the correct records, but the form that it is attached to only shows the record selectors and all the fields appear to be "hidden." I thought it may be one of the form's properties set incorrectly but I checked on the test form from another database that I used and each have what appears to be identical settings. So I'm at a loss!
So it turns out even though I using a query that holds all the fields it will not display the content unless you go to the Add Existing Fields and add all the the fields you want to see. This seems really silly especially when the results in the query but at least its working now.
I had this problem and discovered that having the property DataEntry set to YES will only display new records. From Microsoft Help:
You can use the DataEntry property to specify whether a bound form
opens to allow data entry only. The Data Entry property doesn't
determine whether records can be added; it only determines whether
existing records are displayed. Read/write Boolean.

Can someone explain Rails behavior for multiple fields with identical names and ids?

I needed to create a input mask for a jQuery datepicker in my Rails app, where the first form field uses m/d/yy format and the datepicker populates a hidden input with the proper database format.
I was using SimpleForm, and so I extended my own input so that the input is preceded by the mask.
I got everything set up and when checking out the browser, it all just worked well before I thought I would be done.
The form ends up with two inputs for the same attribute, each with the same id and name. I never thought this would work. Checking the development log I only see one date getting submitted, the second of the two which is the one that has the proper format for the database.
Is this all okay? Should I take some extra steps even though this appears to work fine, and more importantly, can someone explain what's going on under the hood that results in this behavior?
Thanks!!
Rails uses the Hash params to store fields submitted. When you declare two or more inputs using the same name, it happens the same as if you do something like
h=Hash.new
h[:name]="foo"
h[:name]="bar"
Result is bar because the foo was overwritten. So the "winner" is always the field value which the browser last appended to postdata.
But if I where you, I would not rely on the browser that the second field gets appended at last.

BDE says "Field not found" but field exists

I have the following query to one of my database tables:
select count(*) as mycount
from mytable
where fieldone = :fieldone
and fieldtwo = :fieldtwo
Parameters are correctly loaded into the query (both of type String).
When I run this query outside the app (for instance, through the dbexplore) and replace the parameters with the actual values, I get the correct result. But when running it in the app, I get a Field 'fieldtwo' not found error, right on the Query.Open call.
Why would the BDE not find this field, when it actually exist?
Update: The following query, executed right after the first one (the one that fails), works fine in the app:
select *
from mytable
where fieldone = :fieldone
order by fieldone, fieldtwo
The best guess is that you have populated the field list in the query, this overrides any concept of the underlying fields that are in the query and is a cause of countless confusion.
Right click on the query, pick the fields editor clear all the values that are there and then choose 'add all fields' that should cause the missing field to appear once the query is executed.
I think it should auto-populate the fields if there are no defined fields when the query is executed, so you may not need to choose 'add all fields' after clearing the fields.
Whenever we come across a problem like this we tend to remove the query from the form and create it dynamically at run time... It depends how ingrained into the form it is...
E.g. If you have a data aware control looking at "fieldtwo" which tries to fetch some data when the underlying data set gets updated then it'll trigger an error like this, but it's more obvious when you've written code such
SomeEdit.Text = Query.FieldByName("fieldtwo").AsString;
That way it falls over on the relevant line instead of the open (triggering a related event)
Clear the query content using Query1.SQL.Clear; statement before opening it.
Other reason can be you are opening other database which may not have the specified field. Be sure that both the DatabaseName's in your app and dbexplore are same
I used to face porblems with BDE when i have SQLExplorer open and the app accesses the DB at the same time (but i had errors like ), try closing the Explorer it may help, if not i would build the SQL as text without the Parameters and try if it works then (if its possible in your situation).
I don't use parameters, so I'm just grabbing at straws here. I still use the BDE regularly, but am no expert. I find I shy away from more complex expressions (which yours is not!) because of the little "surprises" like this that the BDE throws at you.
Perhaps adding parentheses:
where (fieldone = :fieldone)
and (fieldtwo = :fieldtwo)
Or, single or double quote signs (this probably will make it worse?)
where (fieldon = ":fieldone")
and (fieldtwo = ":fieldtwo")
Or, to explore the problem, remove the "and fieldtwo = :fieldtwo" line and see if it runs.
Would it be possible for you to do your own parameter substitution with a StringReplace as in
Query1.SQL.Text := StringReplace(Query1.SQL.Text, ":fieldone", "MyVarName",[rfReplaceAll ]);
If you are creating a ClienDataSet in memory by the Create DataSet method, you should check the TFieldDefs property, which must have a different field name or not created
I was having a weird but small problem, I'll post in case it will help someone in some day.
uRegPeople.pas
with frmEditPerson do
begin
PersonID := qryPerson.FieldByName(ID).AsInteger;
...
end;
I had qryPerson both in frmRegPeople and in frmEditPerson, by using with I was referencing to frmEditPerson.qryPerson, however I wanted to reference to frmRegPeople.qryPerson. Then I need to change to the following code.
with frmEditPerson do
begin
PersonID := Self.qryPerson.FieldByName(ID).AsInteger;
...
end;
// Explanation
// qryPerson --> frmEditPerson.qryPerson;
// Self.qryPerson --> frmRegPeople.qryPerson;

ListGridRecord in smartGWT not displaying items after '<'

I have a ListGrid with ListGridRecords where I am trying to display the straight xml output from a call I'm doing on the backend. Here's an example:
lgr.setAttribute("XML", "<xml><response>Bob</response></xml>");
However, when it goes to display the contents of lgr in the ListGrid, it doesn't display it. (i.e. it is blank). If I make the field editable, I can double click on the cell and it will then display it. Also, if I get rid of the '<' symbols it displays as well. However, that kind of defeats the purpose since I want to display the exact xml used.
Do I need to escape the '<' somehow in the ListGridRecord? What is the best way to do this in GWT?
Ok, just found a thread that seems to solve my problem at least halfway. I would still like to enable the user to copy it without the encoded values, but at least now they can see it. I believe I'll enable some sort of click handler on the fields to to enable the correct copying.
http://www.gwt-ext.com/forum/viewtopic.php?f=7&t=2693

Resources