in reply to Re: Perl Mason2 jquery get the value of a checkbox
in thread Perl Mason2 jquery get the value of a checkbox

how do you put the value of said form field into the Perl variable.?
<input type="checkbox" id = "has_sidebar" name="cb" value="" onclick=" +result=$(this).attr('value', this.checked ? 1 : 0); alert('my result +: ' + result.context.value);" >
here RESULT has the value of the checkbox(0 or 1)

how do i PUT that in a perl variable?

sorry if that is a basic question.

Replies are listed 'Best First'.
Re^3: Perl Mason2 jquery get the value of a checkbox
by Ralesk (Pilgrim) on May 30, 2012 at 23:15 UTC

    By setting the value of your input that has name="cb" to something sensible. For example to 1. Then, when it’s checked, it will send that as part of the form, and when unchecked, it won’t send anything (its name won’t be present in the form data unless there are multiple elements with the same name and at least one of them is checked).

    You absolutely don’t even need JavaScript for this.

    As for catching the form data in Mason — no idea, I’ve never used Mason. Its documentation surely talks about how to deal with data sent via forms.