Skip to content

Commit

Permalink
Add 'mailto:' Function for Mailaddresses
Browse files Browse the repository at this point in the history
  • Loading branch information
ishimoto committed Jul 14, 2012
1 parent 1375d7a commit 465433b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wo:genericContainer elementName="div" otherTagString="$inset" class="$elementClass">
<wo:genericContainer elementName="label" for="$javaScriptElementID"><wo:str value="$^string" /></wo:genericContainer>
<wo:textfield type="email" id="$javaScriptElementID" value="$^value" placeholder="$^placeholder" data-theme="$^theme" disabled="$^disabled" otherTagString="$miniVersion" name="$^name" />
<wo:genericContainer elementName="label" for="$javaScriptElementID"><wo:hyperlink string="$^string" disabled="$disabledInvert" href="$href" data-role="button" data-inline="true" data-mini="true" /></wo:genericContainer>
<wo:textfield type="email" id="$javaScriptElementID" value="$value" placeholder="$^placeholder" data-theme="$^theme" disabled="$^disabled" otherTagString="$miniVersion" name="$^name" />
</wo:genericContainer>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import com.webobjects.appserver.WOContext;

import er.extensions.foundation.ERXStringUtilities;

@SuppressWarnings("serial")
public class ERQMInputMail extends ERQMInputBaseComponent {

Expand All @@ -17,4 +19,28 @@ public ERQMInputMail(WOContext aContext) {
super(aContext);
}

//********************************************************************
// Methods
//********************************************************************

public String value() {
return stringValueForBinding("value");
}

public boolean disabledInvert() {
// No Mail no Link
if(ERXStringUtilities.stringIsNullOrEmpty(value())) {
return true;
}

return !valueForBooleanBinding("disabled", false);
}

public String href() {
StringBuilder sb = new StringBuilder();
sb.append("mailto:");
sb.append(value());

return sb.toString();
}
}

0 comments on commit 465433b

Please sign in to comment.