widget:editvalues problem
Archived from the Xataface Users forum.
meikel — Mon Oct 15, 2007 7:04 am
Hi Steve,
I’m getting following error message (in java console of FireFox) when trying to enter a new “PlateStockSize” or “PSName”:
“Error: unterminated regular expression literal
Source File: http://10.3.0.202/dataface/plone_javascripts.js
Line: 816, Column: 15
Source Code:
Fatal error: Attempt to get relationship nonexistent ‘PlateStockSizes’ from table ‘PlateStockSizes’”
Please find below a snip from my fields.ini
[PlateName]
widget:type = select
vocabulary = PSNames
widget:editvalues = 1
[PlateSize]
widget:type = select
vocabulary = PlateStockSizes
widget:editvalues = 1
——————-
…and my valuelists.ini
[PSNames]
__sql__ = “select PlateNameID, PlateName from PlateStockNames ORDER by PlateName”
[PlateStockSizes]
__sql__ = “select PlateSizeID, PlateSize from PlateStockSizes ORDER by PlateSize”
——————-
All tables are in the same database, but there’s no relationships.ini. Maybe the missing relationships.ini is already the reason for above error?
TIA for your help
kind regards
meikel
shannah — Mon Oct 15, 2007 11:20 am
So the valuelists.ini file. Is it located in the same directory as the fields.ini file? And to which table do they belong?
relationships.ini file shouldn’t be necessary.
If you could post the relevant directory structure, that might help.
-Steve
meikel — Mon Oct 15, 2007 2:07 pm
valuelists.ini is in the same directory as fields.ini. They both belong to a third table in which I’d like to put information from the other (above mentioned) two tables…
meikel
meikel — Mon Oct 15, 2007 2:07 pm
valuelists.ini is in the same directory as fields.ini. They both belong to a third table in which I’d like to put information from the other (above mentioned) two tables…
meikel
shannah — Tue Oct 16, 2007 3:23 pm
Hi Meikel,
This is a tricky one to debug from my vantage point. I can’t seem to reproduce the problem on my end. Any chance you can:
a. send me the app to try to look at (including the db).
or
b. Give me temporary access to the app (ftp access so I can edit the source) so I can do some debugging and find the problem.
(b is preferred because it saves me the set-up time).
Steve
meikel — Wed Oct 17, 2007 11:31 am
Hey Steve,
this site has no direct internet access (intranet ()
Is there any chance you provide me with a simplified or existing setup, so that I can just compare and find out what is wrong on my side?
TIA and kindest regards
meikel
shannah — Wed Oct 17, 2007 10:44 pm
Unfortunately the setup that you described should work properly. An an example set up though, if you installed the LibraryDB application and set the widget:editvalues directive on the borrower_id field in the books table, it works on my test systems.
-Steve
meikel — Thu Oct 18, 2007 6:15 am
Hi Steve,
thanks for your prompt reply. I put now a small version of my setup in my folder on the Plone server. I gave you permissions (at least I hope I did )
Thanks again for looking into this
kind regards
meikel
fantomasdm — Thu Feb 24, 2011 4:56 am
Hi, with widget:editvalues=1 after add a new value, the new item is not visible in select box, I have to refresh page to see it!
Is possible an auto-refresh after add a new value?
shannah — Sat Feb 26, 2011 1:04 pm
What version of Xataface are you using? It should automatically add it to the select list (it may be at the end of the list - or the beginning… can’t remember).
-Steve
fantomasdm — Sun Feb 27, 2011 10:47 am
I’m using 1.2.6
fantomasdm — Tue Apr 05, 2011 6:32 am
Hi, I find problem:
file Dataface\JSON.php
and actions\ajax_valuelist_append.php
I change Dataface\JSON.php in:
- Code: Select all
- `<?php
class JSON {public static function notice($msg){
return self::init(array(‘notice’=>$msg, ‘success’=>0, ‘msg’=>$msg));
}
public static function warning($msg){
return self::init(array(‘warning’=>$msg, ‘success’=>0, ‘msg’=>$msg));
}
public static function error($msg){
return self::init(array(‘error’=>$msg, ‘success’=>0, ‘msg’=>$msg));
}
public static function init($arr){
import(‘Services/JSON.php’);
$json = new Services_JSON();
return $json->encode($arr);}
public function json($arr){
import(‘Services/JSON.php’);
$json = new Services_JSON();
return $json->encode($arr);
/*
if ( is_array($arr) ){
$out = array();
foreach ( $arr as $key=>$val){
$out[] = “’“.addslashes($key).”’: “.JSON::json($val);
}
return “{“.implode(‘, ‘, $out).”}”;
} else if ( is_int($arr) || is_float($arr) ){
return $arr;
} else if ( is_bool($arr) ){
return ( $arr?’1’:’0’);
} else {
return “’“.addslashes($arr).”’”;
}
*/
}
}`
and actions\ajax_valuelist_append.php at line 39 in
- Code: Select all
echo JSON::init(array( 'success'=>1, 'value'=>array('key'=>$res['key'], 'value'=>$res['value']) ) );
But with this code we need to change all JSON::json -> JSON::init
I don’t know where is other call to JSON::json
fantomasdm — Sun Feb 27, 2011 10:47 am
I’m using 1.2.6
fantomasdm — Tue Apr 05, 2011 6:32 am
Hi, I find problem:
file Dataface\JSON.php
and actions\ajax_valuelist_append.php
I change Dataface\JSON.php in:
- Code: Select all
- `<?php
class JSON {public static function notice($msg){
return self::init(array(‘notice’=>$msg, ‘success’=>0, ‘msg’=>$msg));
}
public static function warning($msg){
return self::init(array(‘warning’=>$msg, ‘success’=>0, ‘msg’=>$msg));
}
public static function error($msg){
return self::init(array(‘error’=>$msg, ‘success’=>0, ‘msg’=>$msg));
}
public static function init($arr){
import(‘Services/JSON.php’);
$json = new Services_JSON();
return $json->encode($arr);}
public function json($arr){
import(‘Services/JSON.php’);
$json = new Services_JSON();
return $json->encode($arr);
/*
if ( is_array($arr) ){
$out = array();
foreach ( $arr as $key=>$val){
$out[] = “’“.addslashes($key).”’: “.JSON::json($val);
}
return “{“.implode(‘, ‘, $out).”}”;
} else if ( is_int($arr) || is_float($arr) ){
return $arr;
} else if ( is_bool($arr) ){
return ( $arr?’1’:’0’);
} else {
return “’“.addslashes($arr).”’”;
}
*/
}
}`
and actions\ajax_valuelist_append.php at line 39 in
- Code: Select all
echo JSON::init(array( 'success'=>1, 'value'=>array('key'=>$res['key'], 'value'=>$res['value']) ) );
But with this code we need to change all JSON::json -> JSON::init
I don’t know where is other call to JSON::json