[ic] Interchange demo: userdb mail_list field cannot be set to empty

Mike Heins mike at perusion.com
Thu Nov 5 18:09:34 UTC 2009


Quoting David Christensen (david at endpoint.com):
> 
> On Nov 5, 2009, at 11:49 AM, Mike Heins wrote:
> 
> >Quoting Stefan Hornburg (Racke) (racke at linuxia.de):
> >>Ton Verhagen wrote:
> >>>
> >>>Quoting Mike Heins wrote:
> >>>
> >>>>Quoting Ton Verhagen (ton at verhagen.net):
> >>>>>
> >>>>>Ton Verhagen wrote:
> >>>>>
> >>>>>>Dear IC'ers,
> >>>>>>
> >>>>>>In the current demo on www.icdevgroup.org it is not possible to  
> >>>>>>set
> >>>>>>the userdb field mail_list to an empty value.
> >>>>>>In other words, users are not able to unsubscribe from all  
> >>>>>>mailing
> >>>>>>lists. The last value always remains active.
> >>>>>>
> >>>>>>The demo uses a multiple select box for this feature. I have also
> >>>>>>tried checkboxes with no avail.
> >>>>>>
> >>>>>>Any ideas?
> >>>>>
> >>>>>
> >>>>>Apparently an empty cgi variable does not overwrite an existing  
> >>>>>value
> >>>>>variable.
> >>>>>
> >>>>
> >>>>This is not true at all.
> >>>>
> >>>>You can test it yourself:
> >>>>
> >>>>
> >>>>http://demo.icdevgroup.org/i/demo1/ord/checkout?fname=ton&mv_action=refresh
> >>>>
> >>>>
> >>>>That will show your name. Now do:
> >>>>
> >>>>
> >>>>http://demo.icdevgroup.org/i/demo1/ord/checkout?fname=&mv_action=refresh
> >>>
> >>>
> >>>You might be right in this regard.
> >>>
> >>>But please try similar things with check boxes and/or multiple  
> >>>selects:
> >>>an empty selection (no checkboxes ticked) won't overwrite an  
> >>>existing
> >>>value in the session.
> >>>
> >>
> >>Yeah, but the better solution is probably do set the mail_list  
> >>value inside
> >>"Save_database" scratch.
> >
> >Yes, or something. You could do:
> >
> >	[calc]
> >	    $Values->{mail_list} ||= 'none';
> >	    return;
> >	[/calc]
> 
> 
> Wouldn't an empty hidden with the same name work in that regard?  If  
> checkboxes are not checked, they are not included in the CGI params,  
> so they cannot be unset in that fashion; an empty hidden would provide  
> the 'name=' that you need, although some filter may be needed to strip  
> the \0 from the value when a "real" value is included.
> 

Good idea. The widget for detecting the current value should still work
just fine with that.

<form>
    [display table=userdb type=multiple column=mail_list key="[data session username]" applylocale=1]
    <input type="hidden" name="mail_list" value="">
    <input type="hidden" name="mail_list" value="">
</form>

You could also rewrite the filter (null to space in this case) to poke a
blank value into variable if there was nothing present.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.328.4479  <mike at perusion.com>

Fast, reliable, cheap.  Pick two and we'll talk.
-- unknown



More information about the interchange-users mailing list