[ic] mv_click

Bill Randle interchange-users@lists.akopia.com
Wed May 9 17:54:00 2001


On May 9,  3:46pm, JoshNarins@aol.com wrote:
} Subject: Re: [ic] mv_click
}
} Ed LaFrance <edl@newmediaems.com> wrote...
}
} }Your right. It seems that the input type 'image' does not recognize a name
} }or value attribute - though browsers will be tolerant if you give if
} }one.  You will have to resort to a 'click_map' or a javascript trick (see
} }the 'Checkout' button on the construct demo basket page) for this.  Take a
} }look at the docs on Forms (Interchange Templates is the correct section, I
} }think) for info on click maps.
}
} Which is where I will be going, but I thought I'd mention that the
} following does not work.
}
} }Try setting your mv_click value as a hidden field in the form. E.g.:
} }
} }     <INPUT TYPE=hidden NAME=mv_click VALUE="Check for Number">
} }
} } Then name your mv_click block:
} }
} }     [set Check for Number]
} }       [perl]
} }          # your perl code
} }       [/perl]
} }     [/set]

I just ran a test on this and it really does work - at least with
Minivend 4.04. I took an existing, known working form and modified
it slightly to use an image instead of a text submit button.

I used feedback.html from the mv4 "simple" demo and made the
following simple changes:

37c37
<       [if !value feedback_message]
---
>       [if !cgi feedback_message]
40c40
<       [elsif !value feedback_subject]
---
>       [elsif !cgi feedback_subject]
65c65
< <INPUT TYPE=hidden NAME=mv_check VALUE=check_form>
---
> <INPUT TYPE=hidden NAME=mv_click VALUE=check_form>
73c73
< : <INPUT TYPE=submit VALUE=Send>
---
> : <INPUT TYPE=image SRC="new.png">

which effectively changes a mv_check into a mv_click (just so we're
talking apples and apples) and replaces the submit button with a
handy image.

I then loaded the feedback.html page, entered some text, leaving the
email and message fields blank, and clicked on the "new" image.
Minivend properly displayed the form page with text (in red) at
the top of the page telling me to enter a message. To me, this
means it worked.

Now I haven't looked at the latest Interchange demos, but I'll refer
you to the results.html page in the IC 4.6.3 "construct" demo. That
page uses a hidden input type to set the mv_click value to pre-process
the form results. This page uses a standard submit button, rather
than an image, but unless something changed between mv4 and IC4.6 in
the way forms are processed, it should work equally well using an
image.

Note that I'm not commenting on whether your Perl script is
correct or not - only on being able to invoke a mv_click method
using a image as a submit button.

As another person said earlier, make sure your basic processing is
working correctly first, then change the text submit button to an
image. Everything should continue to work just fine.

} And, for completeness, in case you joined us more lately, the original
} question...
} }}
} }} Subject: [ic] mv_click
} }}
} }} I am trying to adjust the main Search function in the Templates.
} }}
} }} I'd like, if the user enters a number, to limit the mv_search_field to
just
} }} the SKU field in that case.
} }}
} }} In Perl, it seems that is as simple as,
} }}   if ( $CGI_array->{'mv_searchspec'}[1] =~ /^\d+$/ ) {
} }}     $CGI_array->{'mv_search_field'}[1] = "sku";
} }}   }
} }}
} }} And it seems like I am supposed to use mv_click to make it happen.
} }}
} }} The problem is that the submit button is an image, and even when I name
} }} it mv_click, it does not seem to execute the code wrapped in...
} }} [set mv_click]
} }}  [perl]
} }}    Perl code mentioned above.
} }}  [/perl]
} }} [/set]
} }}
} }} Am I correct in trying to set this up in the templates?
} }} I would imagine pages/results.html would be too late to try to change
} }} something like mv_search_field...

	-Bill

P.S. Don't name your image "mv_click", either.