[ic] table-editor/username help needed ???

Ed LaFrance interchange-users@interchange.redhat.com
Wed Apr 10 11:04:01 2002


At 09:38 AM 4/10/2002 +0930, you wrote:
>In-Replay-To:
>
> >   Hi list;
> >
> > I am trying to do few things but I am having some difficulties.
> >
> > This is what I am trying to do:
> >
> > 1. I have search box where you enter customer_id or some other info
>and
> > you get list of customers, where customer id is link to another page
> > that will display more details.
> >
> > so far so good, that all works fine.
> >
> > 2. Next you can clik on customer name and it will bring you to
> > table-editor page where you can edit some customer info.
> >
> > that is working fine to. I can edit info, save them to db no problems.
>
> >
> > 3.Here is my problem. I am now trying to enter some info in the form.
> > All values that are saved in db are already visible on form. The only
> > thing that I am missing is username.
> >
> > I tried everything but I can not reteive username.
> >
> > All other info such as fname,lname, address,zip,company etc are there
> > only I am missing my username.
> >
> > I tried something like:
> >
> > <INPUT TYPE="hidden" NAME="username"  VALUE="[data session username]">
>
> > nothing filed is empty.
> >
> > I tried something like [value mv_username] etc.
> >
> > No luck simply it does not know what is username.
>
> >>Is there anything in the catalog error log ?
>
>There is nothing in error log.
>
> >>>Who's username - the owner of the session?
>It is not ovner of the session, it is username of customer that I did
>access
>trough table-editor page.
>
> >>That will always be available as [value mv_username] or [data session
>id].
>Is this so case if I am not logged in as that user???
>
> >>You described getting a list of customers as the result of some
> >>kind of loop or search,  and subsequently clicking on a 'customer_id'
>to
> >>get to a form view for that customer. Assuming the 'customer_id' is
> >>actually a username from userdb, the username on your form view should
>be
> >>available as [data session arg] if you followed the normal conventions
>for
> >>flypages.
>
>Yes that  all works fine Ed, but the only problem is that now I am
>trying to access separate page called evaluation.html
>that has form (normal form with text fields, text areas select box, etc)
>on it.
>
>ie:
>[update values]
>[set mv_data_enable]1[/set]
>[tag flag write]evaluationdb[/tag]
>
><FORM ACTION="[process]" METHOD="POST">
><INPUT TYPE=HIDDEN NAME="mv_data_table"    VALUE="evaluationdb">
><INPUT TYPE=HIDDEN NAME="mv_data_key"      VALUE="serial_number">
><INPUT TYPE=HIDDEN NAME="mv_data_function" VALUE="insert">
><INPUT TYPE=HIDDEN NAME="mv_nextpage" VALUE=@@MV_PAGE@@>
><INPUT TYPE=hidden NAME="mv_form_profile" VALUE="evaluation_profile">
><INPUT TYPE="HIDDEN" NAME="mv_data_fields"
>VALUE="serial_number,username,company,email
>........................>
>
>Now all information on this form are visible (ie those ones that are in
>userdb such as company,email etc).
>
>The only value that I am missing is username (it exists in userdb)
>
>I tried
>
><INPUT TYPE="hidden" NAME="username"  VALUE="[value mv_username]">
>
>But there is nothing visible.
>
>Is it possible that I can not access  those info because I am not logged
>in as that user and because I got to this page  as described above???
>
>I tried to set up username as follow:
>[set name=User_ID interpolate=1]
>[sql type=list query="select username from userdb where company='[value
>company]' AND email='[value email]' AND address1='[value address1]'  AND
>city='[value city]' AND zip='[value zip]' AND country='[value
>country]'"][sql-code][/sql]
>[/set]
>[else]
>[seti User_ID]
>[calc]
>$Scratch->{mv_autocreate} =~ /mv_username=(\w+)/;
>$1;
>[/calc][/seti]
>[/else]
>[/if]
>
>And that works fine.
>
>Also I have another isses. If I access information like this (ie I am
>not logged in) and I try to create new account it will assume that I am
>new user not existing one.
>
>How can i prevent this ????
>
>This is part of my account.html page:
>
>[if session logged_in][bounce href="[area account_update]"]
>[else]
>[tmp auto_create]1[/tmp]
>         [if type=explicit compare=|
>                 [userdb
>                         function=new_account
>                                 assign_username=1
>                                         password='[value zip]'
>                                                 verify='[value zip]'
>                 ]
>                 |]
>            [/if]
>[/else]
>[/if]
>
>
>This is the  reason I need to know how to tell interchange that I am not
>new user I already exist. It seems to me that since I am not logged in
>id does not know what is value on mv_username.
>
>I hope so that I did clear this for you a bit.
>
>Thank you so much guys.
>
>Alma

I still do not completely understand the intent of what you are doing, but 
in any case, on evaluation.html, the username should be available as 
whatever form variable name you captured it with on the previous form. So 
if you did this on the first form:

         <input type=hidden name=username value="[data session arg]">

you should be able to get the username on this from like this:

         <input type=hidden name=username value="[value username]">

As far as your second question goes, you should avoid trying to create a 
"third party" userdb account with the [userdb new_account] function - it is 
really not intended for that, though it is possible to do so. Take a look 
at the way new user account creation is handled in the UI->Customer area 
for an example of how to go about this.

- Ed L.


>

===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================