Problem/Motivation

In certain circumstances the noscript code can make the page look rather broken as it's inserted before the form code. It may also be preferable to insert the message into the form itself.

Proposed resolution

Provide an option to make the noscript code output as a suffix instead of a prefix on the form, or as a form element.

Remaining tasks

Provide a patch.

User interface changes

The noscript output could be rendered after the form instead of before.

API changes

New variable.

Data model changes

n/a

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new2.07 KB

This provides an option to control whether the code addition is done via #prefix (default) or #suffix.

damienmckenna’s picture

Title: Allow positioning the noscript code after the form » Allow the form's placement to be controlled
Issue summary: View changes
StatusFileSize
new2.56 KB

This provides another option that renders the message as a form element, which works fairly well with this change to antibot-no-js.tpl.php:

form.antibot .form-item, form.antibot .form-submit { height: 0; margin: 0; visibility: hidden !important; }

damienmckenna’s picture

Status: Needs review » Needs work

The last patch breaks forms which Antibot is added to.

quondam’s picture

Status: Needs work » Needs review
StatusFileSize
new3.5 KB

@DamienMcKenna looks like your last patch was breaking forms because the inline element that was being inserted into the form was overriding the $form['antibot'] element, which had an identical array key. Renaming that inline markup `antibot_inline` resolved that naming conflict.

The existing inline CSS in the template file was hiding entire forms by default - which also suppressed all child elements inside the form. I've refactored those styles to accommodate the two markup structures rendered by D7 core so that only children of the form that aren't <noscript> tags are hidden.

Finally, I noticed that including a hash in the array keys for the options in the new placement selection in the admin form was preventing the labels for the radio buttons from rendering. Those have been stripped out of the admin form, then re-added via string concatenation after the config variable is retrieved by antibot_form_pre_render()

danrod’s picture

StatusFileSize
new91.69 KB

I'm looking into this again, given that many sites still uses the 7.x release: https://www.drupal.org/project/usage/antibot

Applied the patch cleanly, worked fine for me:

Antibot admin changes

Tested with a form and had no issues, I'll move it to RTBC

danrod’s picture

Status: Needs review » Reviewed & tested by the community
danrod’s picture

danrod’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.