[ic] Trying to figure out how to get custom forms into databases

Chris Chaney interchange-users@icdevgroup.org
Wed Sep 11 11:57:01 2002


Thank you for the link but after trying it out I'm still lost.

I've done the following:

<!-- BEGIN CONTENT -->

  <FORM METHOD=POST ACTION="[process]">
    <INPUT TYPE=HIDDEN name="mv_doit" value="return">
    <INPUT TYPE=HIDDEN name="mv_nextpage" value="@@MV_PAGE@@">
    Code <INPUT TYPE=TEXT SIZE=8
                            NAME="update_code"
                            VALUE="[value update_code]">
    <INPUT TYPE=SUBMIT name="mv_submit"  Value="Select">
    </FORM>

<FORM METHOD=POST ACTION="[process]">
    [set update_database]
    [if type=data term="userdb::trusted::[data session username]"]
        [set mv_data_enable]1[/set]
    [else]
        [set mv_data_enable]0[/set]
    [/else]
    [/if]
    [/set]
   <INPUT TYPE=hidden NAME=mv_click VALUE=update_database>
   <INPUT TYPE=HIDDEN NAME="mv_data_table"    VALUE="survey">
   <INPUT TYPE=HIDDEN NAME="mv_data_key"      VALUE="code">
   <INPUT TYPE=HIDDEN NAME="mv_data_function" VALUE="update">
    <INPUT TYPE=HIDDEN name="mv_nextpage" value="@@MV_PAGE@@">
<INPUT TYPE=hidden NAME="mv_data_fields"
               VALUE="code,age,favcol,favsport">
   <PRE>   [loop arg="[value code]"]
   Code <INPUT TYPE=TEXT NAME="code" SIZE=10 VALUE="[loop-code]"
size="20">
  Age <INPUT TYPE=TEXT NAME="age" SIZE=30
                   VALUE="[loop-field age]">
      Favorite Color <INPUT TYPE=TEXT NAME="favcol"
                   SIZE=30 VALUE="[loop-field favcol]">
        Favorite Sport <INPUT TYPE=TEXT NAME="favsport"
                   SIZE=10 VALUE="[loop-field favsport]">
   [/loop]
   </PRE>
       <INPUT TYPE=hidden NAME="mv_todo" VALUE="set">
       <INPUT TYPE=submit VALUE="Update table">
   </FORM>

<!-- END CONTENT -->

But it doesn't seem to update the database table.  To recap in my test
there is a table called survey with four fields: code, age, favcol,
favsport.

Code is the primary key.  The above code should modify the record for
whatever is put into code shouldn't it?  But it doesn't...what am I
doing wrong?

Sincere thanks for the help,

Chris

-----Original Message-----
From: interchange-users-admin@icdevgroup.org
[mailto:interchange-users-admin@icdevgroup.org] On Behalf Of Chris
Chaney
Sent: Wednesday, September 11, 2002 1:43 AM
To: interchange-users@icdevgroup.org
Subject: [ic] Trying to figure out how to get custom forms into
databases

How exactly does it work when a user fills out a form on an Interchange
page and submits it that it enters it into a database table.  How can I
set it up myself?

For example, lets say we have a user named John (ID) logged in and we
present him with a form.

Favorite color: blue, black, red, or yellow (favcol)
Favorite sport: soccer, basketball, American Football (favsport)
Age: ____ (age)

Now we have a special database table called surveys with

ID | favcol | favsport | age
------------------------------

What interchange code would we put into the form page to tell
interchange to put the submitted information into the 'surveys' table?

    <FORM ACTION="[process secure=0]" METHOD="POST" ....????

What tags would we use? What hidden variables would we use? Would we
name the form variables the same as the variables in the table?   We we
have to create a form processor (no idea how to do that) or could we set
this up in the page itself?  Lets say we we didn't want to input it into
a table if his age was older than 12.

Can someone help me figure this out?  This has been a major stumbling
block of mine and as of yet haven't figured it out.  Any help would be
greatly appreciated.

Thank you,

Chris


_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users