Form errors keyword questio


(Tony Kidman) #1

Hi All,

 

is there a way (keyword modifier) to display form_errors based on whether form errors are present.

 

I have used the following:

 

%form_errors_message^notempty:<div class="errors">Errors here</div>%

 

I would however like to use %form_errors% inside the div?  Is this possible? 

 

i have tried :

 

%form_errors_message^notempty:<div class="errors">form_errors</div>%

 

but not successful.

 

Many Thanks


(Nic Hubbard) #2

I would just use javascript to solve this. It is what I have always done.


(Bart Banda) #3

Here are a couple of things you could try:

  • Use the %form_errors_message% along with a keyword modifier to put a class on the <div> wrapping the errors. So for example <div class="%form_errors_message^notempty:show-errors^empty:hide-this-div%"
  • Use the tagif modifier on the form errors keyword to add a tag to it and style that with CSS instead of the outer wrapper, for example: <div class="errors">%form_errors^tagif:div%</div>

Try any of those and let us know if that works/helps. 


(Tom Chadwin) #4

There's also the replace_keywords modifier which would help your last attempt.

 

Tom