# Mechanize: save and cancel doesn't work in JSPWiki

**URL:** <https://www.ruby-forum.com/t/mechanize-save-and-cancel-doesnt-work-in-jspwiki/71631>\
**Category:** Ruby\
**Created:** [October 10, 2006, 2:06pm UTC](https://www.ruby-forum.com/t/mechanize-save-and-cancel-doesnt-work-in-jspwiki/71631 "2006-10-10T14:06:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![michele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed8c4c/32.png) [@michele](https://www.ruby-forum.com/u/michele)\
**Post date:** [October 10, 2006, 2:06pm UTC](https://www.ruby-forum.com/t/mechanize-save-and-cancel-doesnt-work-in-jspwiki/71631/1 "2006-10-10T14:06:36Z")

</div>

I’m trying to submit data in JSPWiki (edit page). I can read the data  
in the form, but nothings get saved when I submit the page. Cancel  
doesn’t work either. I don’t get any errors. There is no JavaScript  
used to submit the form.

After I’m logged in I do the following:

def save(page, content)  
@agent.get(@base\_url + “Edit.jsp?page=#{page}”)  
form = @agent.page.forms.with.name(‘editForm’)  
form.fields.name(’\_editedtext’).value = content  
form.submit(form.buttons.first)  
end

And this is the cancel method (the @agent already got the edit page)

def cancel  
form = @agent.page.forms.with.name(‘editForm’)  
form.submit(form.buttons.name(‘cancel’))  
end

Michele

---

<div class="post-metadata">

**Author:** ![michele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed8c4c/32.png) [@michele](https://www.ruby-forum.com/u/michele)\
**Post date:** [October 11, 2006, 2:19am UTC](https://www.ruby-forum.com/t/mechanize-save-and-cancel-doesnt-work-in-jspwiki/71631/2 "2006-10-11T02:19:25Z")

</div>

On Tue, Oct 10, 2006 at 09:05:10PM +0900, michele wrote:

> ```
> form.fields.name('_editedtext').value = content
> form.submit(form.buttons.first)
> 
> ```
> 
> end
> 
> And this is the cancel method (the @agent already got the edit page)
> 
> def cancel  
> form = @agent.page.forms.with.name(‘editForm’)  
> form.submit(form.buttons.name(‘cancel’))  
> end

Can you try turning on logging, and sending the log to the  
mechanize-users mailing list?

[http://rubyforge.org/mail/?group\_id=1453](http://rubyforge.org/mail/?group_id=1453)

Then I can try to help you out more.

---

<div class="post-metadata">

**Author:** ![michele](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed8c4c/32.png) [@michele](https://www.ruby-forum.com/u/michele)\
**Post date:** [October 11, 2006, 10:22am UTC](https://www.ruby-forum.com/t/mechanize-save-and-cancel-doesnt-work-in-jspwiki/71631/3 "2006-10-11T10:22:08Z")

</div>

Aaron P. skrev:

> > ```
> > form = @agent.page.forms.with.name('editForm')
> > 
> > ```
> > 
> > end  
> > [http://tenderlovemaking.com/](http://tenderlovemaking.com/)  
> > Ok, done

Michele
