Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Class:FormAction $extraClass problem


Reply


1559 Views

Avatar
camspiers

Community Member, 5 Posts

14 July 2008 at 2:59pm

Edited: 14/07/2008 3:00pm

Hi,

I'm using version 2.2.2, and I have run into a problem setting a custom class(HTML) using the FormAction Class. This Class gives you the option (using the Class constructor) to set a extra class to output in the generated HTML.

This is implemented by the function Field().

function Field() {
      $titleAttr = $this->description ? "title=\"" . Convert::raw2att($this->description) . "\"" : '';
      return "<input class=\"action " . $this->extraClass(). "\" id=\"" . $this->id() . "\" type=\"submit\" name=\"{$this->name}\" value=\"" . $this->attrTitle() . "\" $titleAttr />\n";
   }

When I try to use this existing code my extra class is not added, so i have changed it to:

function Field() {
      $titleAttr = $this->description ? "title=\"" . Convert::raw2att($this->description) . "\"" : '';
      return "<input class=\"action " . $this->extraClass . "\" id=\"" . $this->id() . "\" type=\"submit\" name=\"{$this->name}\" value=\"" . $this->attrTitle() . "\" $titleAttr />\n";
   }

And voila.
Hope this helps someone.
Sorry if the code doesn't format properly, I have not used this forum for submitting code.