Uploading multiple files to cocoon - file-upload

I'd love to see cocoon handle multiple files uploaded by user. My form is something like
<input name="file" type="file" multiple />
For single files (without multiple attr) it seems quite easy. Calling cocoon.request.get("file") in a flowscript apparently returns instance of org.apache.cocoon.servlet.multipart.Part so i guess I'm missing something obvious?

Related

Custom "Not Found" option in bootstrap-select when live searching

Using Bootstrap 3, and bootstrap-select v1.13.2
I have created a bootstrap-select with live-search turned on. Below is a simple example.
<select class="form-control selectpicker" id="customer" name="customer" data-live-search="true">
<option>Customer Inc</option>
...
<option>Customer LLC</option>
<option>New Customer</option>
</select>
I would like it to display the New Customer option, if no other customers are matched while using the live search.
I found this answer to a similar question, but I can't figure out where to put that code, and I can't comment to ask for clarification (brand new account).
EDIT:
Apparently the above referenced answer is for a completely different (albeit similarly named) plugin. Does anyone know if what I want to do is possible with the plugin I'm already using? It would be a pain to switch it out over many pages.

Vb.net : Submitting multpart/related form to cloud via web service call

I am a newbie to VB.net and web services in general.
I am working on designing a feature that ,
i.Accepts a document (Content-type : multipart/related) from outside.(Parameterized input to my code maybe ?)
ii.Does a call on a web service to submit that to a cloud server (eg. maybe amazon , maybe something else)
I want to know where to start with this,
i want to create a small vb.net project first that accepts as input some (multipart/related form based document) and does a call(post) on a web service that sends out that data to the cloud.
How are these multipart documents posted ?
Edit :
The web service API i am working on will have a WebMethod that will accept a file (xml/json) as input and create a multipart/related document and then post it to a web service. i did see posts here that work with creating multipart/form-data but am not sure if the way to create a multpart/related document will be the same because multipart/related documents work with compound documents.
Ref: Upload files with HTTPWebrequest (multipart/form-data)
From this question, your HTML might look something like this:
<form id="uploadbanner" enctype="multipart/form-data" method="post" action="#">
<input id="fileupload" name="myfile" type="file" />
<input type="submit" value="submit" id="submit" />
</form>
From here, this server side code may get you started:
Dim savedFile As String
savedFile = Path.GetFileName(Me.fileUpload.PostedFile.FileName)
Me.fileUpload.PostedFile.SaveAs(Server.MapPath("cvs\"))
"Submit[ting] to a cloud server" is going to be completely dependent on which service you use. You'll have to choose one first, and I'd be willing to bet they have some kind of API with examples to help you use their service. In addition, there are probably great examples here on StackOverflow to get you going. The search function can be a great help when you're ready.

How to post form data to Apache Sling using a Java servlet

I am trying to POST the data from a html page and post it to a sling using a java servlet..
Note: My webapp is running in tomcat(port 8080), and my sling runs in a different port(8999).
my html is a very simple form with just one input box
<form action = "/data" method="post">
<input type="text" name="input" />
<input type="submit" name="Submit" />
</form>
and in the servlet i have received the data in the input box.
Sting name = request.getParameter("input")
I also went through to the documentation in the official docs, but didnt find anything helpful regarding this.
Any code that help me understand the post part will be helpful.
Reworked answer taking into account your question edits: it looks like what you want is to make POST requests from another Java application to Sling.
If that's correct you can use the httpclient library which is discussed in another question here, see How do I make a WebDav call using HttpClient?

Required fields in Mechanical Turk

Is there any way to make fields required in an Amazon Mechanical Turk HIT? I get some blank responses to the textboxes or radiobuttons in my HTML form and the Amazon's documentation doesn't seem to provide any mechanism for validation.
The easiest way would probably be to use Amazon's API call 'createHIT' to create your HIT: http://docs.amazonwebservices.com/AWSMechTurk/latest/AWSMturkAPI/index.html?ApiReference_CreateHITOperation.html
Then, you can specify your HIT questions using a 'questionForm' data structure, which allows defining any field as 'required', and enforces it when the form is submitted.
I think adding the required attribute to your element works fine.
<input class="form-control" id="url" name="url" placeholder="Enter URL here" required="" type="url" />
I would suggest you create your HIT on an external server, used javascript for form validation and then display the questionnaire on Mechanical Turk using an iFrame.
If you don't mind creating an external web app to host your question form, you can create an external HIT and do your validation there.

Authorize.net SIM Process w/Master Pages using VB.NET returns Error 13 Invalid User

I am trying to use Authorize.net's SIM payment gateway process and am using the base code provided on the developer site. The problem is I am using Master Pages with my site and the hidden field names are getting concatenated with the nested control IDs as an example:
This is what the field should look like:
<input type="hidden" runat="server" name="x_login" id="x_login" />
The output ends up looking like:
<input name="ctl00$MainContent$x_login" type="hidden" id="ctl00_MainContent_x_login" value="MyCode" />
Normally that would not be a problem except Authorize.net is picky about field names apparently since I keep getting Error 13 invalid user. I went through their forums and opened a customer support ticket a week ago, no response other than the automated check our forums email. The closest thing I found on their forums is other people with Master Pages having the same problem with no answers.
I also used their developer response site to check out the values that I am sending them and they all seem to be correct, including the field names. I am at a loss. I can post the entire subset of code but it is the code from their site pasted into my contentholder.
The other work around I have is since my Masterpage already has a form I added these lines of code:
Me.Form.Action = "https://test.authorize.net/gateway/transact.dll"
'Me.Form.Action = "https://developer.authorize.net/tools/paramdump/index.php" This link will show all of the form elements that are submitted.
Me.Form.Method = "Post"
The above lines seem to work properly as the output code looks correct.
Finding no help anywhere else I thought I would ask the people who have not let me down yet.
Here is the answer. After trying a lot of different paths, it is definitely the MasterPage that frags the post to Authorize.net. I tried re-"name"ing the controls among several other things and for time conisderations I gave up trying to resolve the issue and just reformatted the page to not use my masterpage file. I am also building a silverlight e-commerce solution and I am a little concerned that I will not be able to use authorize.net for the same reason.