Trying to use CartThrobs Inline Errors within a add_to_cart_form to validate a simple form with two fields. For the price field, the validation works, but for the item_options[invoice_number] it does not. Here is the code for the form and both fields.
{exp:cartthrob:add_to_cart_form
return="/portal/checkout/" secure_return="no"
on_the_fly="true" allow_user_price="yes"
title="Invoice Payment" quantity="1"
error_handling="inline"
rules:item_options[invoice_number]="required|is_numeric"
rules:price="required|is_numeric"
shipping_exempt="yes" tax_exempt="yes"
}
<div class="row">
<div class="six columns">
{if error:item_options[invoice_number]}<span class="error">{/if}
<label for="item_options[invoice_number]">Invoice #</label>
<input type="text" name="item_options[invoice_number]" class="textinput required" value="" />
{if error:item_options[invoice_number]}<p>Enter a value.</p></span>{/if}
</div>
<div class="six columns end">
{if error:price}<span class="error">{/if}
<label for="price">Amount</label>
<input type="text" name="price" data-symbol="$" class="textinput required dollar-amount" value="" />
{if error:price}<p>Enter a numeric value.</p></span>{/if}
</div>
</div>
<div class="row">
<div class="large-12 columns">
<input type="submit" class="btn btn-large spacebeforesm" value="Enter Payment Info →" />
</div>
</div>
{/exp:cartthrob:add_to_cart_form}
The error
Error
You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}.
Parser State: Unexpected ‘[’ (MISC); expected RD in Template “portal/pay-invoice” on line 27.
Line 27 is the first {if error:item_options[invoice_number]}. It will render if I remove the brackets {if error:item_options} Does not matter what value I insert between the brackets, the page will not render.
Documentation doesn't indicate that it won't work with item_options. And as often as the item_options is used, it is also likely that it works with item_options.