fs_button and PlainText not serializable
Author: zava
Publication Date: 6/8/2020 15:55
Hi,
I have a problem with a fs_button and JS code as param
$CMS_VALUE(
fsbutton(
editorName:"suggestedDate",
parameter:{ "date":"$('date').get('value')".plain }
,
callback:"refreshPage"
)
)$
the button will be not rendered and i got on js console this error
SEVERE: [encodeButtons] failed (in 73 ms)!
java.lang.IllegalArgumentException: Element is not serializable: '$('dateFrom').get('value')' (class de.espirit.firstspirit.common.text.PlainString)!
my form button
<FS_BUTTON
name="suggestedDate"
alwaysEnabled="yes"
hFill="yes"
hidden="yes"
icon="fs:ACTION"
noBreak="yes"
onClick="script:kb_suggest_dates"
style="button"
useLanguages="no">
<LANGINFOS>
<LANGINFO lang="*" label="Fixtermin eintragen" description=""/>
</LANGINFOS>
</FS_BUTTON>
-
Author: felix_reinhold - 6/10/2020 10:04
Hi Antonio,
did you try to log the return of $('date').get('value')? According to the error I'd guess the value just isn't serializable cause it's complex, null, undefined or sth. else.
Maybe just try sth. like "typeof($('date').get('value'))".plain cause typeof always returns a String. If you don't get the error anymore the issue seems to be realted to the value of $('date').get('value')
Best regards
Felix
0 -
Author: zava - 6/15/2020 14:00
Hi Felix,
Thx, I found an alternative solution in top.WE_API.Common.execute("script:
<script type="text/javascript">
function create_event(){
top.WE_API.Common.execute("script:create_event",
{
"convert": true,
"kb_type": "$CMS_VALUE(#global.section.template.uid)$"
},
function(result){
refreshPage(result);
}
);
}
</script>
<button onclick="create_event();" class="fs-button fs-button-button">
<span class="fs-button-iconlabel ">
<span class="fs-button-icon"><span data-fs-resource-icon="ACTION"></span></span>
<span class="fs-button-label middle">In eine Veranstaltung umwandeln</span>
</span>
</button>
0
Please sign in to leave a comment.
Comments
2 comments