[ic] Code convert of Form input data

interchange-users@interchange.redhat.com interchange-users@interchange.redhat.com
Fri Sep 7 11:57:10 2001


Quoting murahashi@ayayu.com (murahashi@ayayu.com):
> We have to convert input data from form input, and insert/update interchange
> database.
> Like this.
> 
> {Form input} ---> [code conversion] ----> [interchange database]
>                  ISO-2022-JP    ====>    euc-JP
> 
> Code conversion means, for example, from ISO-2022-JP to euc-JP.
> 
> For search function like below, we don't know way to convert code of
> searchspec.
> 
> <FORM ACTION="[area search]">
> <INPUT TYPE=hidden NAME=mv_coordinate VALUE=1>
> <INPUT TYPE=hidden NAME=mv_searchtype VALUE=db>
> <INPUT TYPE=hidden NAME=mv_matchlimit VALUE=10>
> <INPUT TYPE=hidden NAME=mv_sort_field VALUE=category>
> <INPUT TYPE=hidden NAME=mv_search_field VALUE=inactive>
> <INPUT TYPE=hidden NAME=mv_search_field VALUE=":*">
> <INPUT TYPE=hidden NAME=mv_column_op VALUE=ne>
> <INPUT TYPE=hidden NAME=mv_column_op VALUE=rm>
> <INPUT TYPE=hidden NAME=mv_searchspec VALUE=1>
> <INPUT MAXLENGTH=30 NAME=mv_searchspec type=text size=10>
> <INPUT TYPE=image alt="Search Go" border="0" src="navigation/go.gif"
> width="23" height="17">
> </form>
> 
> Any idea or help would be appreciated.

I am afraid I don't know how to do the conversion, but assuming there
is some code that does that, just add a filter:

    [input-filter name=mv_searchspec]
	    my $val = $CGI->{mv_searchspec};
	    # code to effect the conversion goes here
	    return $val;
    [/input-filter]

If you have already defined a $Vend::Interpolate::Filter that does
the conversion, then it is just: 

    [input-filter name=mv_searchspec op=your_filter][/input-filter]

If mv_searchspec is *always* to be filtered, you can instead
do in catalog.cfg:

	Filter mv_searchspec your_filter

Presumably you would use an external module to convert it, in which
case you would make a global UserTag to access it, and your code
inside the filter would look like "$val = $Tag->your_convert_tag($val)".

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

Research is what I'm doing when I don't know what I'm doing.
-- Wernher Von Braun