开发者

Get the id of the checked radio button with perl

I am brand new to Perl.

Currently i am doing something like this to get the value of the selected radio button in the group

$myVariable = param('radioButtonGroupName');

I was wondering if it were possible t开发者_开发技巧o get the ID of that selected radio button.

Thanks


No it is not possible, the ID is not sent to the server.

You could set the value and the ID to the same, but that might not work for your application.


You can, but not directly.

What you need to do is the following workaround:

  • Create a HIDDEN input element <INPUT TYPE=HIDDEN NAME='radio_id' VALUE=''>

  • On your radio buttons, create an onChange handler, which will contain JavaScript code to check which radio button was pressed and its ID, and populate the ID value into radio_id's elemebt's value.

  • Your script will then have access to the ID via param('radio_id');

Then again, simply matching IDs and values for radio button would be sufficient :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜