I am currently learning CouchDB and using the O'Reilly book as a guide to get started. I've been following it pretty thoroughly, however, upon working with Sofa, the book requires me to inspect what happens when we hit 'Save' on our edit template. The book says that I should see a success response (uses Firebug the button triggers the Put request), however, instead I get a "
{"error":"not_found","reason":"missing shows function new.html on design doc _design/sofa"}"
Now I only started reading this week and I know the answer might be obvious, but if someone could at least point me in the right direction (where in Sofa to add, fix a bug, patch) that would be great.
My initial guess is that I need to add a "new" shows function, but I just wanted some advice before I delve into this wild goose chase.
sorry if this is a noob question.
{"couchdb":"Welcome","uuid":"4d9b6082e16607a33dcbfdffb57503b5","version":"1.6.1","vendor":{"version":"1.6.1","name":"The Apache Software Foundation"}}
Downloaded the newest version of Sofa from (https://github.com/jchris/sofa)
How to resolve the issue
The issue is that the page is being accessed from:
http://127.0.0.1:5984/myblogdb/_design/sofa/_show/edit
Access it instead from:
http://127.0.0.1:5984/myblogdb/_design/sofa/_show/edit/
(Your database name may differ from 'myblogdb'). Note the trailing backslash.
Explanation of why a show function called "new" is not necessary:
Take the following query to a show function:
http://127.0.0.1:5984/myblogdb/_design/sofa/_show/edit/This-is-a-second-post
This will call the function in edit.js and pass in the document with an _id of This-is-a-second-post, if such a document exists. If the document doesn't exists, as in the case of
http://127.0.0.1:5984/myblogdb/_design/sofa/_show/edit/new.html
Then edit.js sets up the data object passed to Mustache.to_html to have the correct fields for a new post.
Why it breaks in your case
When the edit show function is accessed via
http://127.0.0.1:5984/myblogdb/_design/sofa/_show/edit
The relatives paths to the scripts no longer work.
Then the script defined in edit.html is no longer correct.
As a result, the submit handler
$("form#new-post").submit(function() { ...
is no longer called. If it were called it would return false at the end, which prevents new.html from being POSTed.
Since it is not called, new.html ends up being POSTed, and that redirects the browser to
http://127.0.0.1:5984/myblogdb/_design/sofa/_show/new.html
which points to a non-existent show function, resulting in the error message you are seeing.
Related
I am a newbie when it comes to InstallShield. I have a Setup.RUL that I am guessing is driving the entire installation process. However, there is a function called OnInstalledXXX() (XXX is a randomly chosen name) that is called at the end of the installation. However, I cannot find the caller anywhere in the RUL. When I debug it and put a break in the function, it gets hit. But if I change the name of the function from OnInstalledXXX() to OnInstalledYYY(), then it won't be called.
Does anyone know how this thing works and where is the caller?
Thanks
It could be marked as a Feature Event. Those are linked by name, so changing the name of the function would break it like you describe. You can either search in the Direct Editor for the function's name, or you can visit each of your project's features to find it. (Of course the latter will only work if I guessed correctly.)
In a production application that I have developed sometimes I get an error saying .getDocument() is null. I have added checks in my code that traps an error if this happens. And the strange thing is that the XSPDocument seams to be OK.
Any other ideas how to debug the cause of this?
========================================================
Edit
The lower parts of the application is a simple database, create an assignment it gets status new
change the status to ongoing thru a button. Add information in text, date and numberfields, no Richtext, no attachments.
The user can switch to another xpage to send this document is an pdf attachment in an email.
The user can save the document as a draft
When they are done the click on an approve button and this button will set the status to approved. Save the document and send it as an pdf to an email adress
The problem ocurrs both on the Save button and on the approve button.
.getDocument from the xsp document is null the xspdocument.getNoteID return an ID
I can do replaceitemvalue on the xsp document.
It never happens on new documents only existing what I have seen
It feels like the comment from David that the backend doc is dropped/recycled
we experienced the same getDocument() problem recently. Finally we found a root cause: two different XPages were loaded simultaneously via iFrames. One of those XPages produced run-time error randomly, in 25% of cases. A sort of conflict in JSF model in context of single session.
solution: viewState="nostate"
not sure if it helps in your case, but this option resolved a lot of problems in our applications. It was introduced in 8.5.3. And it should be especially useful for so called XAgents.
Hard to give a hint without knowing more about everything else, but I remember having seen this as well. Just a few ideas:
Is XSPDocument.getNoteID() pointing to a valid Document if this happens?
Is it maybe pointing to a different doc than what you expected?
Could there be some kind of dynamic change of datasources going on?
Maybe some kind of timeout so that the server all of a sudden forgot who you are (in rare cases this happens to me)?
Lothar/edcom
It would be helpful to have a few more details. I assume that the document has previously been saved and it's not a new note?
You're not trying to put the actual document object inside a scoped variable are you? That would be bad as that would be pretty toxic. Without knowing more I would think this could be the case. The backend document has been garbage collected.
i need some help related to masked field in web form. Syntax of phone field is (___)___-_____, if i execute this code in ruby shell
browser.text_field(:id => 'txtphone').set '7893457889'
... nothing has been added in the phone field.
then i find this solution in one blog, someone said first unmask this field using this code.
browser.text_field(:id,'txtphone').fire_event("unmask")
then write the above code again.
browser.text_field(:id => 'txtphone').set '7893457889'
but still nothing has happened. kindly help me out...am i doing right or still there is a mistake.
If you could provide some sample of the page HTML it will be easier to give you an answer more likely to work.
Given what you have provided us to work from, we have to go with the normal way that such masked input fields typically work and go from there. Usually pages with this kind of thing are calling a javascript function which is triggered by a specific event. Most often this is an event such as onchange but it may be something like keypress or any other even that happens when a normal user types or pasts text into the cell.
You likely need to experiment with using the '.fire_event' method to fire the proper javascript event, or if that fails entirely making a direct call to execute the proper script
When doing this do not confuse the name of a script such as 'applymask' or somesuch with the javascript event which causes that script to be invoked.
The answers to this question How to find out which JavaScript events fired? include some good information on how to use firebug or the chrome developer tools to figure out what events are being fired when you interact with an object on the browser screen.
Update: instead of responding here to indicate if this answer was of any use the OP reposted their question here Masked Text Box issue and by digging around on the vendor's demo site (since that time he actually had posted some of the HTML when we asked for it) I was able to find a solution using watir-webdriver that worked for him.
Is there anyway to validate the search field (I'm using custom search) before sending request to server? Validation is working fine with row editing and adding mode. Let say I want to search column price and error message should occur when user enters a text in search field.
If search returns no data, I want to post a message on the screen. I see no events in search function that can get the server response. The onClose event happened when the search box is closed, but I don't know how to get the server response from this?
Another question, I've tried to use gridResize but it's not working, everything else is working just fine, I see no resize icon in bottom right corner. Please take a look at my code below:
jQuery("#list").jqGrid('gridResize',{minWidth:350,maxWidth:800,minHeight:80,
maxHeight:350});
The part of your question about the validation of the custom searching seems be the same which I answerd here. The answer include the demo where the validation of the 'Client' field is included.
How you can see, the custom searching is moved in the grid.addons.js module in the 4.0.0 version of jqGrid, so it can be removed in some later versions of jqGrid.
There are no special searching request to the server. There are exist just the standard request to fill the grid, where the _search parameter (corresponds to search parameter of jqGrid) are set to true and some other parameters like filters describe the filter criteria. So you can use emptyrecords parameter of jqGrid (see here). You can follow the demo (see the answer) which shows the message in the grid body.
You problems with gridResize seams me very easy. i suppose, that you either not included jQuery UI JavaScript (including of CSS only is not enough) or you placed call of gridResize in the wrong place. You don't posted the JavaScript code and the HTML code which could shows which JavaScripts files you have loaded and in which order. So I can not answer more exactly.
Not having much luck with this query in the ExpressionEngine forums and it's time-sensitive, so I figured I'd see if there's any EE-junkies hanging around Stack Overflow.
I'm working on an EE extension and I need to know what hooks to use to parse a custom field's contents when it's first saved, parse it before being displayed to be edited, and parse it when the edited contents are saved once more. My problem is I'm new to EE extension development, and I'm having trouble figuring out which in the long list of hooks I need to use. Best I can tell:
submit_new_entry_end is what I need to tie into when the entry is first created
publish_form_entry_data is what I need to tie into for parsing before the user edits the entry
And I must be overlooking the hook that will let me edit the entry data before it is saved back to the database. Anyone have some advice?
Thanks!
With trial and error, I finally answered my own question. The hooks that you want in order to parse a custom field's contents on save and reparse them before the entry is displayed are:
submit_new_entry_start (called whenever an entry is submitted; "new" appears to be meaningless)
publish_form_entry_data (I had this one right)