How would I go about implementing the functionality that allows for a hidden field value to automatically be filled in depending on the image selected (in this case based off the anchored link) that way it can be passed when the form this menu is inside gets submitted. I figure regexing the anchored link on the next page might be a bit problematic if somebody wanted to be malicious and edit the value after the # before submitting the link. In this case I would like for bug to be passed if the first option is clicked, content for the second, and so on and so forth (basically it fills in whatever is currently in the anchored link)
Menu code -
<div id="feedback-topic.buttons">
<a href="#bug"><img src="lib/feedback-bug_off.jpg" alt="bug" width="75" height="49" border="0" class="img-swap" /></a>
<a href="#content"><img src="lib/feedback-site_content_off.jpg" alt="site_content" width="121" height="49" border="0" class="img-swap" /></a>
<a href="#suggestion"><img src="lib/feedback-suggestion_off.jpg" alt="suggestion" width="117" height="49" border="0" class="img-swap" /></a>
<a href="#compliment"><img src="lib/feedback-compliment_off.jpg" alt="compliment" width="120" height="49" border="0" class="img-swap" /></a>
<a href="#checkout"><img src="lib/feedback-checkout_off.jpg" alt="checkout" width="107" height="49" border="0" class="img-swap" /></a>
<a href="#other"><img src="lib/feedback-other_off.jpg" alt="other" width="83" height="49" border="0" class="img-swap" /></a>
</div>
jQuery code -
// Allows for only one feedback topic to be selected
$(function(){
$(".img-swap").live('click', function() {
this.src = this.src.replace('_off', '_on');
$('.img-swap').not(this).attr('src', function(index, attr) {
return attr.replace('_on', '_off');
});
});
});