Populate plugin not working correctly - json

Hi i'm trying to retrieve and populate a form. The following link with username Testing and password test123 .
The page is returning a correct JSON object (I tested it by putting on screen between paragraph tags) but the populate plugin is not populating. In firebug it show "no such element as" without displaying the element's name. The input field names are exactly the same is in the DB.
any ideas?

The problem is that your success callback gets passed a string argument, instead of the expected Object/Array, which causes the populate method to treat the whole input as a single unnamed value. This is caused by a typo in the options object passed to your $.ajax() call:
$.ajax({
// ...
datatype: 'json'
});
The option names are case sensitive and the correct spelling for the datatype attribute is dataType with a capital tee. By default, if the datatype option is missing/misspelled, jQuery will try to intelligently guess the datatype of the response and return the result as a formatted string (see the jQuery documentation). So just rename the datatype option to dataType and your fields get populated correctly.

Related

Wanting to display a method return using HTML 5 data attribute

So I have a dynamic table in angular where im passing data in, then creating the table. I want to add some CSS in order to check the values then add some styling onto it. So if the value is a minus number, then display the data in red
I have used attribute data to check the actual data, which works fine until i call to typescript method to generate the data instead of hardcoding the data in, and this is where is goes wrong. So I want to call this method to get the data instead, and it just displays the method name instead of the method return
You can use the attribute binding of data instead of the interpolation if the data returned by the method is not a string - more details here
[attr.data]="getData(header, body)"

Taleo extract process add blank field in output CSV file

I am using Taleo Connect Client to export data from Taleo. I encountered two questions:
How can I add blank columns to an output CSV file?
For example, try to add ColumnBlank1 between Column_FirstName and Column_LastName.
Column_FirstName|ColumnBlank1|Column_LastName
John||Lee
Adam||Jackson
How can I set default value like "N" for one field?
DBaluke Huang's answer was correct, but he left out some details. Adding the full solution for others who might need this too.
To export a blank or fixed string value in a column using TCC (Taleo Connect client) do the following:
Open your Export
Click the projections tab
Click the add button
Click Projection Function
Choose the Replace Function
Click ok
In the First Parameter Section: In the Value box, add any string field
from your list on the entity tab. The Data Type should be Field.
In the Second Parameter Section, In the Value box, add the same field
from Parameter 1 value box. The Data Type should be Field.
In the Third Parameter section, In the value box, enter no value for
blank or enter the fixed string you want in all records.
Then change the data type to string in this section.
For those unfamiliar with the replace function you are looking for the string Parameter1.Value in Parameter2.value and then replacing all instances where the string is found with parameter3.value
You can export a blank field with <quer:string/>.
<quer:projection alias="Blank" xmlns:quer="http://www.taleo.com/ws/integration/query">
<quer:string/>
</quer:projection>
Steps
Open your export in Taleo Connect Client.
Open the General tab and set the Export mode to "CSV-report".
Open the Projections tab.
Click Add.
Select Add a complex projection and click OK.
Under Complex projection, enter the following:
<quer:projection alias="Blank" xmlns:quer="http://www.taleo.com/ws/integration/query">
<quer:string/>
</quer:projection>
Save your changes.
Example:
<quer:query productCode="RC1704" model="http://www.taleo.com/ws/tee800/2009/01" projectedClass="Candidate" locale="en" mode="CSV" csvheader="true" csvdelimiter="|" largegraph="true" preventDuplicates="false" xmlns:quer="http://www.taleo.com/ws/integration/query">
<quer:subQueries/>
<quer:projections>
<quer:projection>
<quer:field path="FirstName"/>
</quer:projection>
<quer:projection alias="Blank">
<quer:string/>
</quer:projection>
<quer:projection>
<quer:field path="LastName"/>
</quer:projection>
</quer:projections>
<quer:projectionFilterings/>
<quer:filterings/>
<quer:sortings/>
<quer:sortingFilterings/>
<quer:groupings/>
<quer:joinings/>
</quer:query>
Results:
FirstName|Blank|LastName
John||Lee
Adam||Jackson
Jane||Doe
Notes:
If you get a SAX parsing error when running the export, make sure your Export mode is set to "CSV-report". (Appears as mode="CSV" in source)
When adding a complex projection in TCC, you must include xmlns:quer="http://www.taleo.com/ws/integration/query", or else TCC will call your source "invalid". However, it is not required when editing your export's source directly outside of TCC.
I resolved the issue by:
Add a function projection in Projections. Set your Alias. Set First parameter value as whatever field that available. Set the second parameter's value as same as the first parameter. Change Third parameter's value as "blank" and set Data type as String.
Same step as the first question, and set Change Third parameter's value as "N".

Field value fetch when field name is not known

I am using a form builder using which my admin side can create forms and store it as JSON. They are rendered dynamically when the client accesses these forms. When the client submits the form at the back end I need to get the value of all the fields.
Currently I am trying to do this as follows:(Node Server)
router.post('/increase', function (req, res, next) {
req.session.counter++;
var ans = req.body;
console.log(ans+" this got printed");
res.redirect('docfill');
});
I cannot specify a name after req.body as i dont know the field name due to the dynamic nature of the forms.
The console prints [Object object]. The currently rendered form has a date field I need. And if I put it through JSON.stringify() it prints {}. Is my fetched data coming out to be blank? Could it be a problem with using the data field.
EDIT
its not because the filed is a date type, dosnt work with text either
There could be 2 reasons for this:
You have not installed/required the bodyParser module.
In your form tag you're using the enctype attribute as enctype="multipart/form-data". Reason for this being you're not using any module for handling the multipart/form-data type which is unreadable by the browser. Use enctype="application/json" instead.

Enummerate Field Names In Swagger

So I have done some hunting around online, and have been able to figure out how to use the enum tag in a swagger doc to specify a list of possible values for a field. However, in my current API what I need instead is to have a list of potential fields, each of which has a string value.
To be more precise, I have a POST request that sends JSON in the request body. As part of this request users need to send a single ID field. However, we accept multiple types of ID fields. So the request would look something like this:
{name:"name", product:"product", [FirstIdType, SecondIdType, ThirdIdType]:"ID Value"}
So I need to have the user submit a JSON that has a name, product, and one of FirstIdType, SecondIdType, or ThirdIdType. Technically it is required to have exactly one of those three ID types in the request, but I don't really mind if that isn't possible in the swagger doc. Noting it in the description for the field is fine.
The other constraint is that I can't really change the design at this point. The app has already been built using this design and changing it is out of my hands. Which means that I can't just make an array of ID Types and then choose one of them.
Here is the relevant bit from my swagger doc. The area that needs changed is the ID field. Any thoughts or directions on how to get that to go forward would be really appreciated.
definitions:
request_post:
description: (post) request schema
properties:
name:
type: string
product:
type: string
Id:
type: string
Instead of defining what optional fields can come on the path, you can label the fields that are required and make the rest variable by default.
http://swagger.io/specification/#parameterObject
required boolean Determines whether this parameter is mandatory. If
the parameter is in "path", this property is required and its value
MUST be true. Otherwise, the property MAY be included and its default
value is false.

HTML form submission with special characters

I am trying to submit a form field whose value is Transaction ID - sample . When the date gets submitted the value is Transaction ID ? sample
How do I get rid of the ?
I used HTML special codes for dash/long dash/short dash but still value gets submitted as ?
Please help
The only way to ensure that all input characters get sent correctly is to use UTF-8 character encoding for the form data. This happens automatically if the page containing the form is UTF-8 encoded (and declared to be that); otherwise, use the parameter accept-charset=utf-8 in the form data.
Naturally, you form handler must then be prepared to handling UTF-8 encoded data.