[SOLVED] Make a listbox field mandatory

Moderator: crythias

Locked
HervE
Znuny wizard
Posts: 391
Joined: 03 Jan 2011, 17:15
Znuny Version: 3.3.8
Location: France

[SOLVED] Make a listbox field mandatory

Post by HervE »

Hello forum,

It seems easy to have a textbox field mandatory in a .dtl with:
<label class="Mandatory" for="XXX">
and
<div id="XXXError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>

But how to make a listbox field mandatory?

As I explained here, I added the listbox for priorities in the Reply page. But now I want to make this field mandatory.
Does anybody know how to?

Regards,
HervE
Last edited by HervE on 07 Mar 2012, 15:36, edited 1 time in total.
OTRS 3.3.8 - Windows 7 - IIS7 - SQL Server - Firefox 30
HervE
Znuny wizard
Posts: 391
Joined: 03 Jan 2011, 17:15
Znuny Version: 3.3.8
Location: France

Re: Make a listbox field mandatory

Post by HervE »

Hello forum,

I somehow managed to have it mandatory.
I get no "This field is mandatory" popup unfortunately. (Does anybody know how to?)

Yet the field has to be selected in the listbox, and its caption appears in red.
Here is what I did in the related .pm file:

Code: Select all

	$Param{PriorityStrg} = $Self->{LayoutObject}->BuildSelection(
		Data => \%PriorityList,
		Name => 'NewPriorityID',
		%Priority,
		Class => 'Priority Validate_RequiredDropdown ',
	);
This is the Class => 'Priority Validate_RequiredDropdown' parameter that makes it mandatory.

Regards,
HervE
OTRS 3.3.8 - Windows 7 - IIS7 - SQL Server - Firefox 30
Locked