cms:CMSButton for form submit

Mark Handy asked on December 18, 2015 17:51

I'm trying to custom the layout for the Smart Search box. I've been able to make the submit button a button and not an input, but i can't figure out how to stop the term 'search' from displaying. I can't use CSS text-indent since i'm using a :before with FontAwesome.

The docs for the control say i can use Text, but that doesn't seem to work.

https://devnet.kentico.com/docs/8_0/api/html/AllMembers_T_CMS_ExtendedControls_CMSButton.htm

Correct Answer

Zach Perry answered on December 18, 2015 21:04

You can modify the webpart. Just change GetString("general.search" to "" and it won't use search when the webpart doesn't have a value.

 public string SearchButtonText
{
    get
    {
        return DataHelper.GetNotEmpty(GetValue("SearchButtonText"), GetString("general.search"));
    }
    set
    {
        SetValue("SearchButtonText", value);
        btnSearch.Text = value;
    }
}
1 votesVote for this answer Unmark Correct answer

Recent Answers


Roman Hutnyk answered on December 18, 2015 17:56

Not sure I understood you correctly, but isn't it something you can change in web part setting dialog?

0 votesVote for this answer Mark as a Correct answer

Mark Handy answered on December 18, 2015 18:02

you can, but when i leave that field blank, Search is rendered. I don't want any text, since i'm using content:"" within the CSS to display an icon. Ideally, i don't need the value attribute.

1 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on December 18, 2015 18:07

Then in your custom layout remove the value with javascript.

I believe you can also add a "submit" button using standard HTML in the form layout and specify what you need in there, I've done this before without issue.

1 votesVote for this answer Mark as a Correct answer

Mark Handy answered on December 18, 2015 18:08

Search Button Text sets the value attribute. Leaving this blank defaults that attribute to Search. Making this field   works, but isn't ideal. It would be nice if the field is empty, there is no default.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on December 18, 2015 18:22

Then a simple javascript function to remove it would handle the problem at hand from a "global" standpoint if that's what you're looking for. You could also look into creating a .skin file for those buttons, you might be able to set the value to a blank value by default. Just throwing options out there I guess...

1 votesVote for this answer Mark as a Correct answer

Mark Handy answered on December 18, 2015 19:25

I try to avoid dom manipulation with JS. using the non-breaking space will work. This is only on one location in the mast head.

Cheers

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.