Forum OpenACS Development: Re: Handling numbers in samplenote example

Collapse
Posted by Joel Aufrecht on
I believe you want "int".  I still haven't been able to find much documentation for this stuff - there's a little bit embedded within the code for the various template functions, but if anybody who is aware of any documentation related to form-builder would like to dump a pointer into this thread I'd be happy to consolidate and cross-link it all within the product next version.
Collapse
Posted by Daniel D on
Hello Joel,

Thank you for the tip. I thing that it isn't the right input type since I have now this error:

element phone_no: data type "int" is not valid
    while executing
"ad_form -name contact -form {
    contact_id:key
    {fname:text
        {label "FirstName"}
    }
    {lname:text
        {label "LastName"}
    }
  ..."

So i have used integer instead. This time I got access to the page, however I have this error when trying to save input data:

Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")

ERROR:  parse error at or near "p_creation_date"

SQL:
        select phonebook__new(null,'Daniel', 'D','01234567989',null,'292',null,null)

    while executing
"ns_pg_bind 0or1row nsdb0 {
        select phonebook__new(null,:fname, :lname,:phone_no,null,:user_id,null,null)
    }"
    ("uplevel" body line 1)
    invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql"
    invoked from within
"db_exec 0or1row $db $full_statement_name $sql"
    invoked from within
"if {[regexp -nocase -- {^\s*select} $test_sql match]} {
            ns_log Debug "PLPGSQL: bypassed anon function"
            set selection [db_exec ..."
    ("uplevel" body line 6)
    invoked from within
"uplevel 1 $code_block "
    invoked from within
"db_with_handle db {
        # plsql calls that are simple selects bypass the plpgsql
        # mechanism for creating anonymous functions (OpenACS - ..."
    (procedure "db_exec_plsql" line 13)
    invoked from within
"db_exec_plsql do_insert { *SQL* }
"
    ("uplevel" body line 2)
    invoked from within
"uplevel #5 {
db_exec_plsql do_insert { *SQL* }
}"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 $args"
    (procedure "ad_page_contract_eval" line 2)
    invoked from within
"ad_page_contract_eval uplevel #$level $new_data"
    (procedure "ad_form" line 594)
    invoked from within
"ad_form -name contact -form {
    contact_id:key
    {fname:text
        {label "FirstName"}
    }
    {lname:text
        {label "LastName"}
    }
  ..."
    ("uplevel" body line 15)
    invoked from within
"uplevel {
          ad_page_contract {
        Simple add/edit form for phonebook.
} {
    contact_id:integer,optional
}

set user_id [ad_maybe_redirect_..."
    (procedure "code::tcl::/web/service0/packages/phonebook/www/contact-edit" line 2)
    invoked from within
"code::tcl::$__adp_stub"
    invoked from within
"if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init tcl $__adp_stub
..."
    ("uplevel" body line 3)
    invoked from within
"uplevel {

    if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init t..."
    (procedure "adp_prepare" line 2)
    invoked from within
"adp_prepare "
    (procedure "template::adp_parse" line 30)
    invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
    (procedure "adp_parse_ad_conn_file" line 7)
    invoked from within
"$handler"
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
    $handler
      } ad_script_abort val {
    # do nothing
      }"
    invoked from within
"rp_serve_concrete_file [ad_conn file]"
    (procedure "rp_serve_abstract_file" line 60)
    invoked from within
"rp_serve_abstract_file "$root/$path""
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
    rp_serve_abstract_file "$root/$path"
    set tcl_url2file([ad_conn url]) [ad_conn file]
    set tcl_url2path_info([ad_conn url]) [ad_conn path_inf..."

Do you have any ideas hot to make this working?

Thank you very much.

Daniel

Collapse
Posted by Joel Aufrecht on
It would appear that the error is occuring within the __new procedure that you created.  I say that because that's the place where "p_creation_date" appears.  So you modified the stored procedure, and it compiled but fails to run.  Look for obvious errors there; then try running the same commands directly (in psql or in sql mode in emacs) to get more information.