i have form and in form text area and submit button
when i click on submit button and share data taken homepage banner and text not textarea text
<form id="facebook-form" method="post">
<ul class="form-list">
<li>
<label for="facebook-content"><?php echo $this->__("Post on Facebook") ?>:</label>
<div class="input-box">
<textarea id="affiliate-facebook-content" class="required-entry"><?php echo $this->getDefaultSharingContent() ?></textarea>
</div>
</li>
</ul>
<div class="buttons-set">
<button type="button" class="button" title="<?php echo $this->__('Post on Facebook') ?>" onclick="postOnFacebook();">
<span><span><?php echo $this->__('Post on Facebook') ?></span></span>
</button>
</div>
my javascript code:
function postOnFacebook() {
if (facebookForm.validator.validate()){
var params = Form.serializeElements($('facebook-form').select('input, select, textarea'));
var url = '<?php echo $this->getUrl("affiliates/refer/test") ?>';
var message = $('facebook-content').value
// calling the API ...
if(message) {
// alert(message);
var obj = {
method: 'feed',
link: $('personal_affiliate_url').href,
description: message
};
function callback(response) {
if (response && response.post_id) {
$('affiliate-facebook-msg').show();
}
else{
alert('This message hasn\'t been posted successfully!');
}
}
FB.ui(obj, callback);
}
}
}
Any help would be appreciated.
Thanks.
来源:https://stackoverflow.com/questions/57680369/php-form-textarea-text-on-facebook-share-when-click-on-button