dKab dKab - 10 months ago 65
Javascript Question

Why CasperJS fills text input with [object Object]

I use this code to fill text input

spooky.then([{question: question}, function(question) {
this.fill('form[name="askmore"]', { questionask: question}, false);

I have a valid sting in
. Here's a form markup:

<form action="" name="askmore" id="askmore" method="post" onsubmit="return false;">
<table cellspacing="0" cellpadding="0" border="0">
<input type="text" maxlength="400" name="questionask" id="questionask" style="padding-left:15px; margin-left:45px; font-size:20px; width:480px; height:43px; border:0px; background-color:#d4d4d4; ">
<img hspace="15" src="/images/button.png" id="send" style="cursor: pointer;">

Anyone know how to fix this? I think I'm doing it just like in the example from CasperJS documentation


Simply don't pass question as an argument:

spooky.then([{question: question}, function() {
    this.fill('form[name="askmore"]', { questionask: question}, false);