Javascript search widget with add/remove criteria - javascript

I'm looking for a FOSS Javascript widget which allows you to add/remove search criteria using a GUI.
My basis is the search criteria in Mac OS X Finder, but I know I've seen similar systems elsewhere:
alt text http://img714.imageshack.us/img714/579/screenshot20100429at805.png
The basic idea is that each row corresponds to one field in your database, and depending on the type of that field you would get different search options when you select it. You click the + and - buttons to add or remove fields.
Anybody aware of something like this that's already out there? Preferably written to work with YUI, but I don't mind transliterating from a JQuery or Dojo widget.

#lukecyca asked me to post a link to my implementation. This was written for an open source (GPL) project sponsored by a company that I no longer work for, so I can't guarantee that these links will stay up, but here goes.
The source code is currently on BitBucket. There's a client side (Javascript) library that is probably what you're most interested in, but there's also a server side (PHP) component that may be useful. It's pretty messy code (tightly coupled and really rushed), so I'm not sure it will even be useful, but there is a bit of documentation to help explain it. It's also been modified quite a bit since I left.
There's a demo server that's usually running if you want to see it in action. Please note that the username and password for the demo are listed on that page.

Related

Javascript for offline html documentation

I'm trying to create documentation for use offline (included on a microSD card). I can't assume that the user will have Internet access, nor do I want to assume they will have any installed applications besides a web browser. Therefore, I want to utilize the web browser to dynamically read files. For example, the page might look like this:
Select chapter: <drop-down-list>
Once they select the chapter from a drop-down list, it will simply display under the "Select chapter" part.
Each chapter is a separate .html file. I thought of going old-school with frames, but even then I don't know how I would load the frame based on the drop down item selected. Then I thought I would consider Ajax to not be so 1996, but it seemed like the method for AJAX is "GET" which requires a real webserver.
I know this is very vague, but if somebody has the skills to just whip out a sample how to do this any way possible, that would be awesome. Thanks.
Use selected chapter .
To be more specific, Because you are using a select box, you should implement an onchange method which does something like
document.getElementById('your target frame ID').src="your source html path";.
Please note : Though your question is reasonable and you have understanding of other options available to you, due to exaggerated writing you would get downvotes. You better edit your question just to the point.
Only some browsers will support reading local files using XHR by default (Firefox does, Chrome needs extra flags).
IMHO you should use simple hypertext/HTML instead.
You could have it all in one page but hide/show what you want on chapter selection. Or simply make a huge html with a table of contents on top and use anchors (classic FAQ, help...).

Filtering contentEditable on client and server

I'm developing a Rails web app using the contentEditable feature of HTML 5, in the style of Google Docs and others. This works well for simple typing, but breaks whenever the user tries to paste text from Word or another webpage. The resulting HTML will be littered with style attributes and will look like it was literally cut and pasted from the source.
I need to filter the HTML some way. This can be done client-side, giving a smooth interface for the user where pasted material fits instantly into my app's style.
Of course, the user can override my filtering. So to protect myself fully from tag soup hell, I would need to perform the same filtering again, server-side. This is similar to the form validation problem.
I don't want to duplicate the filtering logic in both jQuery (client-side) and Ruby (server-side) but I don't know if there's any good way to avoid it. So far I have identified two possibilities:
Implement all filtering server-side, access it from the client by AJAX. This will put a heavy load on the server.
Implement filtering fully in JS, run on client and on server through Node.js. I don't know if there is enough similarity between the two platforms to implement a shared filtering routine. Libraries like Cheerio look promising though.
Has anyone solved a similar problem before? I would appreciate any guidance to keep my app as DRY as possible.

Capture all opportunity fields & send to PHP script

I am building an app that lets our sales team (who uses Salesforce) export to a new Evernote note with one click. I have the Evernote functionality already available in a PHP script I wrote, and I was planning on using Javascript to make an XHR to that script, but that is irrelevant at this point.
What I need to be able to do is capture all of the fields in the currently-open opportunity and upon clicking my custom button / link, capture all those fields as a javascript variable that I can then POST to my PHP app. Even a simple example of how I could go about capturing one field would be great -- I can't seem to find anything in the SalesForce documentation that covers this.
What you need here is an Apex callout. This doc on developer.force.com covers it OK, it's a starting point anyway (although it doesn't show you how to query for the fields of Opportunity -- you'll find that in the regular Apex docs under SOQL). For some sample code you might look at the Force.com Toolkit for Google APIs, which uses callouts pretty extensively (although you may need to wade through it a bit to find the relevant parts).
In any case, if you start by searching the docs on Apex callouts, that will probably get you rolling in the right direction.
Another method of doing this, incidentally, would be to wire up a custom button with the AJAX toolkit to compose the body of the post, and then post it and have your PHP page redirect the user back to where he started. That could work too, although my first inclination would be to do it in Apex instead.
Do they really have to click a button? What if meeting some condition would work?
I'm asking because Workflow rules (which are usually good for field updates, creation of Tasks or sending emails) have option to send out a SOAP message. It'd be a somewhat bloated XML but on the plus side - no coding needed, pure configuration. Plus - their delivery status can be tracked easily.
Check the help and at the very least you now have the keyword to Google for ;) Topic on consuming them on salesforce.stackexchange.com might also be useful.
If it has to be under a button - you probably could do with making a fake update of some helper field... Maybe even "count of messages sent"?

How to make a simple event calendar in a c# MVC web project

I'm making a web page that has a calendar in it. It will be used as an event calendar, but I need the events info to come from a database, not hard coded. I also need it so it only displays the events (you can not add one) but when clicked it takes you to another web page (that will add it to the database). I need it this way because of user control. Only the user who creates the event should be able to delete or edit it(which is why I want it to go to another page).
I've been googleing like crazy but have not found anything I need. I did find a calendar called FullCalendar but I can't figure any way to get the events into it. They require an array of events but of course I can't use a server side variable like #Model.events or anything in the javascript. I also can't find one that doesn't allow everyone to edit or delete others posts (which is a security issue).
I'm not familiar with javascript so I have no idea how to get a variable form my database into the script.
Please help. I just want a very simple calendar that shows events that I can get from my own database. Hopefully one that allows hyperlinks as the events name so I can have it go to the events own page when clicked.
Thanks
While it's difficult to answer your question (as you have not provided any code as to what you have tried or researched so far), if you are looking for something simple, I would recommend looking at creating a web helper for your calendar. By doing this, you can do everything you are looking to do without having to use JavaScript. A starting (but very simple) example of a calendar web helper is found here: ASP.NET MVC Calendar Helper
However, might I also recommend that you spend some time learning JavaScript as there is quite a bit you can do to improve the user experience. But, as the previous example shows, you don't necessarily have to.
If I understood you correctly, you need some kind of a calendar where a user can manage his tasks. I can advise you a calendar that requires no knowledge of JavaScript, stores info to a database, and you can adjust access rights to your calendar (so if you need, only one user can make changes to it). It is described in this tutorial, and you can also check the demo. To my mind, it should be a good solution for you.

Text input with options such as Bulleted list

Im looking to create an input field on a web application that is similar to the one we use here for posting questions, where you can put list items, make font bold/italic etc
Does anybody know here know of the code to do this? or could they point me in the right direction of code snippets/hints...ive tried using google chromes 'inspect element' function but cannot find the actual code behind it except that they have a class and id
The languages I can work with are JavaScript, HTML, CSS, VBScript. Ideally I wouldnt want to abstract from these languages at this time if possible.
Stack Exchange uses Markdown, a WYSIWYM (What you see is what you mean) markup language. The original implementation is in Perl, although ports to many other server-side languages are also available.
The editor you're looking at is a modified version of wmd, combined with showdown.js, a JavaScript implementation of the original Markdown language that allows client-side rendering of Markdown text into HTML which allows you to see the preview when writing and editing posts here.

Categories

Resources