lost password?

home
•  xaraya +
•  rails
•  django
•  webdev
•  xamp
•  musings

rss
Tag this page
   

ยป Blogs that link here
last modified: Apr 04, 2007
(first posted: Dec 12, 2006)
(1324 Reads)
keywords: dynamic data
Permalink

BAD_DATA | selection selection selection selection

This obscure error might mean creating hooked dynamicdata has failed

You might see this error on an error page, or maybe somethings just not working and you see this message in your var/logs/log.txt file.

It happens to me when creating an item in one module (via api), which has DD hooked. The item gets created, but when the dd create hook is called, that fails.

Dec 12 18:52:40 0.95465200 +0.876 [ERROR] Logged error: code: 1 BAD_DATA | selection selection selection selection

This means that 4 dd selects failed, invalid inputs.

Tracing it down by disabling my dd properties one at a time, it turns out the four offending ones were all Dropdown List property types. Since I wasnt giving an explicit value for the field, the input validation fails. (Perhaps there are other properties that require an explicit default value too, I don't know).

The solution: make sure each of the dropdown list properties has a value, and/or make sure a Default value is specified in its validation.

Clearing the Error

If you get the error but know its really OK, you can clear it so the user is not confronted with the exception page. For example, I am calling the Articles admin api function to create a new item, and intentionally leaving some hooked DD fields empty (undefined).

$itemid = xarModApiFunc('articles','admin','create',
array( 'title' => $title, 'summary' => $summary, 'ptid' => 11));
if (!$itemid) {
xarLogMessage("Error creating item in pubtype 11 : $title");
return;
}
// allow hooked dd to fail since we're leaving it empty
if (xarCurrentErrorType()==XAR_USER_EXCEPTION && xarCurrentErrorID()=='BAD_DATA') {
xarErrorFree();
}

 

 

 

There are no comments attached to this item.

Post a new comment

How many days in a week?

Name :