Closed farruxx closed 8 years ago
I have this issue, too.
@farruxx The documentation is really faulty.
By checking the source code, I found out that you have to pass the value as second parameter of callback, so:
callback(true)
should be
callback(true, message.text)
It's interesting that nothing is wrote in the documentation.
@farruxx Thanks! Fixed docs
//I believe that the callback(false,message.text) need to be set also? Otherwise $.runForm doesn't work as advertised? Also IsNumeric and toInt didn't work for me.
class FormController extends TelegramBaseController { handle($) { const form = { name: { q: 'Send me your name', error: 'sorry, wrong input', validator: (message, callback) => { if(message.text) { console.log('q: '+ message.text); callback(true, message.text) //you must pass the result also return } callback(false,message.text) } }, age: { q: 'Send me your age', error: 'sorry, wrong input', validator: (message, callback) => { if(message.text && Number(message.text)) { console.log('age: '+ message.text); callback(true, Number(message.tmessage.textext)) return }
callback(false, **message.text**)
}
}
};
$.runForm(form, (result) => {
console.log('form results: '+ result)
});
}
}
Do we need to run jQuery to conform to this module? jQuery.isNumeric( value )
Callback in $.runForm calling with undefined values
{ name: undefined, age: undefined }