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.
Related
Quick question: I have on a website 3 different contact forms for different languages. All 3 forms point to the same PHP script which processes the data and sends it to us via email.
Can I use the same Google Recaptcha v3 key for the 3 forms, or do I have to create different ones?
Also, this is an exceedingly silly question, but just in case: I have seen some sample code where they added a hidden field in the form for the recaptcha response:
<input type="hidden" name="recaptcha_response" id="recaptchaResponse">
From what I understand in the docs, this isn't needed anymore in V3. Instead, you can name the button "g-recaptcha" and capture in the PHP form the $_POST["g-recaptcha"] variable:
<button class="g-recaptcha" data-sitekey="mykey" data-callback='onSubmit' data-action='submit'>
Can anyone confirm that this is the case?
Thanks.
So I am trying to build something for my store but a few things are somewhat unclear.
If I need to save some user settings do I need my own backend just
for that app specifically? For simplicity sake, I want build an app
to save and display a custom message in cart-template.liquid.To
achieve that, I think my app should make a request to my backend (let
say, on heroku) and save it in some db that app is using?
How do I retrieve that data in cart-template.liquid? I guess I
build a snippet that calls a public endpoint of my backend that
returns that saved message using fetch() or maybe axios.get and
embed it using {% render 'fetch-custom-message-snippet' %} ?
Say I ask for user input, ie. "Engraved message" and the form is in cart-template.liquid,
of course. The following snippet is used:
<p class="line-item-property__field">
<label for="engraved-message">Engraved message</label>
<input id="engraved-message" type="text" name="properties[Engraved message]">
</p>
How do I make sure that bit of information is captured and passed to me? I guess I want to see it somewhere in the order details.
If I need to save some user settings do I need my own backend just for that app specifically? For simplicity sake, I want build an app to save and display a custom message in cart-template.liquid.To achieve that, I think my app should make a request to my backend (let say, on heroku) and save it in some db that app is using?
Yes, you need your own backend. Your application alone is responsible for storing its own information (there are some exceptions like a special order field which I show you below) - that typically infers a database that back ups your service and holds your data. Please check out this thread as you can find lots of valuable information there.
Regarding cart-template.liquid I'd suggest taking a look at the official "Shopify Developers" documentation. All information you're allowed to display and request are neatly explained and ordered there.
How do I retrieve that data in cart-template.liquid? I guess I build a snippet that calls a public endpoint of my backend that returns that saved message using fetch() or maybe axios.get and embed it using {% render 'fetch-custom-message-snippet' %} ?
Once again there are good guides out there. I suggest taking a look at this blog post which goes into in-depth on this topic. Shopify's documentation about the Liquid template language is also highly advised to be read.
How do you retrieve that data? According to this specific example any input will be supplied to your order page in the Shopify admin. For example:
<label for="CartNote">Special instructions</label>
<textarea name="note" id="CartNote">{{ cart.note }}</textarea>
*taken from https://shopify.github.io/liquid-code-examples/example/cart-notes*; shows a Special instruction label and textarea for users to submit details about the oder - you will get this data on, as mentioned, the order page in the Shopify admin.
Say I ask for user input, ie. "Engraved message" and the form is in
cart-template.liquid, of course. The following snippet is used:
[...] How do I make sure that bit of information is captured and passed to me? I guess I want to see it somewhere in the order details.
see above
//EDIT:
To prevent any confusion: It seems like you want to develop a custom app just for personal usage and not to publish it in the Shopify App Store - in this case you most often than not don't need an external database; e.g. the example you provided with a simple order request which is easily doable through Shopify's examples.
For your specific case this code snippet (I modified your original example to fit the case - it's not a full cart-template.liquid obviously; in this case the file is called cart.liquid):
<label for="engraved-message">Engraved message</label>
<textarea name="message" id="engraved-message">{{ cart.note }}</textarea>
//EDIT 2:
The link - shared by another user in this thread, namely #Simas Butavičius - is actually kind of useful if you have problems with the customization process in general, i.e. if you want to revise some basic concepts or want to check how to implement the code snippet from above in the whole structure of your website I'd advise to skim through this site.
Needless to say, there are hundreds of good tutorials, questions regarding the same "issue" or other resources in general.
I suggest for further reading purposes to check out some of these links and guides (some may be mentioned above):
https://shopify.github.io/liquid-code-examples/example/cart-notes
https://shopify.github.io/liquid-code-examples/example/checkout-form (! very good in-depth example)
https://www.christhefreelancer.com/shopify-liquid-guide/
https://shopify.dev/docs/themes/theme-templates/cart-liquid
https://shopify.dev/docs/themes/liquid/reference
https://www.shopify.com/partners/shopify-cheat-sheet (! helpful cheatsheet)
https://community.shopify.com/c/Shopify-Design/Cart-Use-cart-attributes-to-collect-more-information/td-p/613718
https://community.shopify.com/c/Shopify-APIs-SDKs/Add-custom-input-fields-to-cart/td-p/154710
https://community.shopify.com/c/Shopify-Design/Product-pages-Get-customization-information-for-products/td-p/616503
Here is the tutorial specifically for creating custom shopify input field for getting engraving information: https://community.shopify.com/c/Shopify-Design/Product-pages-Get-customization-information-for-products/td-p/616503
I know in .Net Core html forms an anti forgery token or something is automatically generated in a similar form like below:
<input name="__RequestVerificationToken" type="hidden" value="CfDJ8KEf24u6Lm9Kv91DDeHZwskS27e4FhK4R1qbdP-wkrXxFFVMoPzUDY5dAJ3Mf63GkB6ZgTNOEe0TKNi4kFJoQaZ7CMoqQoBrzlheq69YP3OY29oYz6VGKAt3KCl2CFfIajrbWf05hi2Oj1fwnmGcxys" /></form>
For the purpose of some snapshot testings, I need to have a way to make sure this token stays exactly the same every time the form page is loaded. The security is not a factor here, since as I said I need this only for the purpose of snapshop testings.
Is there a way to manipulate this token to make sure it keeps a constant value all the time?
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.
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?