Microsoft Translator widget doesn't translate buttons - microsoft-translator

I use Microsoft Translator widget on my site, and it generally works. However, some items on my page are not translated:
Item1
<asp:FileUpload />, which becomes:
<input type="file" />, which is displayed as untranslated English:
* Chrome: "Choose a File..." | No file chosen
* IE: Browse...
I guess this one depends on the browser's display language.
Item2
<asp:Button Text="Submit something", which becomes:
<input (...) type="submit" value="Submit something",
in which "Submit something" is not translated.
Is there any way I can get Microsoft Translator to translate these? I guess I could do the widget's work, call MT API myself and update the value (in the second case), but I'd really rather not.

Microsoft Translator only supports <Button id="Button1" runat="server">My Button</ Button> translations. It doesn't translate the input type=button, asp:Button or telerik:Button nor any other flavor of buttons that you don't place the text for the button in between the tags. Check this article out.
http://social.msdn.microsoft.com/Forums/en-US/a840884b-4efe-4cd4-a598-0ca81842404c/widget-does-not-translate-button-text
I have been looking for a solution similar to what you are but I have found nothing.
So outside of changing all your buttons to this type I am assuming that we would need to use the api to do the translations.

Related

What is required to make browsers send "submit"-input names to the server?

I need to debug missing data in some from POSTed to the server and after reading lots of tutorials and following other examples about that aspect, I still can't find my problem. The use case is pretty simple in theory: Have one form with two submit buttons to trigger different implementation on the server side.
According to lots of tutorials and examples, the submit-buttons should send their name if they have a name-attribute, while values should not be sent at all. The naming thing seems to differ according server side programming languages, sometimes it's some_name and sometimes some_name[], but that doesn't make any difference for me currently.
My problem is that whatever HTML I create, inputs of type submit are never part of the POSTed data. OTOH, pretty much the same HTML as button works as expected: If the button is used to submit the form, its name and even value are part of the POSTed data. When other inputs are clicked to submit, no names of any submit-input are available in the data.
So, with the exact same form, reaching the exact same endpoint, using same browser etc., the following DOES NOT provide any hint to the clicked button in the POSTed data:
<input type="submit"
name="foobar input"
value="foobar input"
title="foobar input"
/>
While the following OTOH does:
<button type="submit"
name="foobar button"
value="foobar button"
title="foobar button">
foobar button
</button>
So, should the input work the same way like the button does in theory? Or is the HTML wrong and I'm not able to spot the error? Sending the form itself works in both cases, though. So the browser obviously knows about the submit-input and its purpose.
Or have something changed the last years in modern browsers and submit-inputs are not part of POSTed data at all anymore for some reason? I can't remember the need to have multiple submits on a form for years.
How does a minimal example using a submit-input sending its name look like and tested to work for you? And in which browser? I tested an up-to-date Chromium based Opera and IE 11 and neither did include submit names.
Thanks!
OPINION: I would personally NEVER use more than one word in the name of a submit button
FACT: If that word is "submit" or you have id="submit" then you will not be able to programmatically submit the form using .submit()
FACT if you have script that disables the form element, it will not be sent to the server
Conclusion
In my experience and according to documentation - If you have the following
<form>
...................
<button type="submit"
name="whatever you want here but I would only use one name and NOT submit">Whatever</button>
</form>
OR
<form>
...................
<input type="submit"
name="whatever you want here but I would only use one name and NOT submit" value"Whatever">
</form>
your server will receive the button as name=value in the POST array if method = post and in the GET if nothing or method=get AND in the REQUEST array in either case (assuming PHP)
TEST PAGE
<form method="post" action="testsubmit.php">
Did not work according to OP<br/>
But it actually DOES work if not disabled from elsewhere <br/>
<input type="submit"
name="foobar input"
value="foobar input"
title="foobar input"
/>
<hr/>
<input type="text" name="sentField" value="This WILL be sent to the server" style="width:300px"/>
<hr/>
<input type="text" name="disField" disabled value="This will NOT be sent to the server" style="width:300px"/>
<hr/>
Does work
<button type="submit"
name="foobar button"
value="foobar button"
title="foobar button">
foobar button
</button>
</form>

Cross-browser and JavaScript-less solution to submit button value issue

Given the following two buttons:
<button type="submit" name="MyButton" value="Foo">Do Foo</button>
<button type="submit" name="MyButton" value="Bar">Do Bar</button>
When clicking these buttons, all browsers except IE7 and below will post the button's value ("Foo" or "Bar"), whereas IE7 and below instead post the text ("Do Foo" or "Do Bar").
(This is an MVC project, but the issue is not specific to MVC.)
This thread has a lot of answers, but none of them will work when:
The value and text are different, and
JavaScript is disabled
We want to support flexible button text so that business can change these through our CMS without a code change. So we can't assume that our text and values will be the same. But we also don't want to depend on JavaScript to solve this.
However, I can't think of any way to solve this without either requiring JavaScript, or keeping the value and text the same.
The usual hack is to key off the name instead of the value.
<button type="submit" name="MyButton_foo" value="Foo">Do Foo</button>
<button type="submit" name="MyButton_bar" value="Bar">Do Bar</button>
Then search the submitted form values for ones that match the pattern /^MyButton_(.*)$/. There are some examples for a variety of languages (although not C#) in an article I wrote some years ago.

Button text different than value submitted in query string

Short version:
How can I have my form's button label text differ from the value submitted to the server without using the <button> tag?
Long version:
I wanted to have the text that appeared in a button in a form to be different than the value submitted in the query string. So, I looked around, and came across this approach...
<button name="method" type="submit" value="repackage">Update Config</button>
...and that worked on IE9 on one of my laptops and I was happy. The user saw "Update Config" and the server received method=repackage in the query string.
Then I brought this app to work and ran it on a workstation, also with IE9. But something had gone wrong. The user still saw "Update Config", but the server now received method=Update%20Config in the query string.
So I investigated some more. I found that www.w3schools.com recommmended not using a <button> tag in a form. They say: "If you use the <button> element in an HTML form, different browsers may submit different values. Use <input> to create buttons in an HTML form" in this article. This seems to be what I am experiencing.
So I looked some more, and found lots of conflicting information about the right way to do this. For example here is a Stack Overflow post that asks exactly this question, but the accepted answer is to use the <button> tag. I can say from experience and research that this is not a reliable approach.
For newcomers: With some CSS this works like a charm as of September 2017:
<form>
<label style="padding:5px; cursor:pointer; border:solid 1px; border-color:#ccc">
<input style="display:none" type="submit" name="method" value="repackage">
<span>Update Config</span>
</label>
</form>
If there's no other way try this:
Use an image button, instead of button. An image button will work as ordinary submit button, but you create an image of the desired button text (no one can change your text then).
<input type="image" src="http://images.webestools.com/buttons.php?frm=2&btn_type=31&txt=Update+Config" name="method" value="repackage">
This works as well. Manipulate the appearance using the bootstrap button classes.
<label class="btn btn-primary">
<input class="d-none" type="submit" name="method" value="repackage">
Update Config
</label>

i need to make an input that looks like this button

I have a button on an html page declared like so:
<button type="submit" name="action" value="sort">SAVE CHANGES</button>
My company demands we support older versions of IE, and in versions 8 and lower when the user goes to submit the form, it passes the text between the 2 button tags. So i need to use an input tag instead. Can someone help me figure out how to create an input tag where the type=submit, the name=action and the value=sort, but hte text on the button says 'SAVE CHANGES'.
Thanks!
Like this:
<input type="submit" name="action" value="SAVE CHANGES" />
However if the value="sort" is important to you perhaps you could move it to an input type="hidden" element.
An option is to use an image button with the text SAVE CHANGES on it.
<input type="image" src="save_changes.png" name="action" value="sort" />
Don't give your submit button a name, make a hidden field with the name and value you want.
<button type="submit">SAVE CHANGES</button>
<input type="hidden" name="action" value="sort" />
So, when the form is submitted, the value "action=sort" will be submitted.
The requirements seem to exclude solutions other than using <input type=image>, which has serious problems; in particular, the coordinates of the clicked location are transmitted, and probably a revision of the requirements will therefore exclude this, too.
Using JavaScript, you could tweak the data before it gets sent, or maybe use an image with an onclick handler that turns it to a button in a sense.
Normally, problems like this should be solved by modifying the server-side code. But if you have some reason why the field name (in the submitted data) must be different from the text in the button, then there does not seem to be any solution, with the given conditions.

How to create custom View and Layouts in Grails

I am wanting to create a page that can load a property file into a text box, edit the properties, and then save the new properties to the file.
Would this be possible by simply using HTML markup? How do I get the push buttons to correlate with my Grails application?
The HTML seems simple enough:
<p>
Select property file:
<input type="file" name"propertyList" size="50"/>
</p>
<p>
<input type="submit" value="Open File"/>
<input type="submit" value="Save File"/>
</p>
<p>
<input type="text" name="properties" size="300"/>
</p>
I'm not quite sure about the submit button as I don't know a whole lot of HTML.
My goal is to simply locate the property file, use groovy to open it and read it line by line and display it in the text box, then be able to edit the properties and save it.
My biggest question deals with the buttons. How do I have the Open File use the button event (onclick) to activate a function I have written in groovy? Or instead of a submit button, what type of input should I use?
Any information leading me in the right direction would be appreciated
EDIT
Is it correct to do something like the following:
<input type="button" onclick="<g:link action="readFile" controller="propertyRead">Open File</g:link>"/>
If not, what would be the proper way to go about it?
EDIT 2
I looked into actionSubmit and also looked a bit more into g:link and was wondering which way (if either) is the better way to go:
actionSubmit (unsure if it allows one to specify the controller as it wasn't stated in the attributes):
<g:actionSubmit value="Open File" action="readFile" controller="propertyRead"</g:actionSubmit>
Or using a menuButton and g:link
g:link:
<span class="menuButton"><g:link action="readFile" controller="propertyRead">Open File</g:link>
Also forgot to ask, is there a way to get the file path from the input type="file" ?
In order to make full use of Grails functionality, you'll probably want to use the associated HTML tags - form (or uploadForm for a form that's uploading the file) and actionSubmit. Grails doesn't offer a custom file input for reasons which I don't remember, so you'll need to use the <input type="file" ...> as shown in your example.