How do I change the error message "Please fill out this field?" - parsley.js

I am having trouble to change this error message. I need the message to be displayed in french.
<input type="text" name="name" id="name" size="30"
class="text-input-big" placeholder="PRÉNOM"
parsley-type="alphanum"
parsley-error-message="Le prénom est requis" required />
I used this for my first field, but no matter what I do, or add, still can't see the message that I want to see.

Since you are using "alphanum" as type, you could use:
<input type="text" name="name" id="name" size="30"
class="text-input-big" placeholder="PRÉNOM"
parsley-type="alphanum"
parsley-alphanum-message="Le prénom est requis" required />
If you specify the message directly in input, you have to do that for every field (and everytime).
So, the best option is using Localization (see http://parsleyjs.org/doc/index.html#psly-installation-localization).
You can download the french localization from here: https://github.com/guillaumepotier/Parsley.js/tree/master/src/i18n. Then you can define your messages in the localization file.

Related

Angular 2 INTERNATIONALIZATION (I18N):Not able find target tag in ganerated xlf file

i am using angular-cli, followed angular-io to generate in Spanish language.
app.component.html
<h2 i18n="header">Login form</h2>
<div>
<span i18n>Email</span>
<input type="text" placeholder="Your email" i18n-placeholder>
</div>
<div>
<span i18n>Password</span>
<input type="password" placeholder="Password" i18n-placeholder>
</div>
<hr>
<div i18n>If you want to search something, go to Google</div>
message.es.xlf
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="ng2.template">
<body>
</body>
</file>
</xliff>
getting generated message.es.xlf file once completing ./node_modules/.bin/ng-xi18n,but not able to find target tag in that file.
please help me
A little late but may help someone. Had the same problem, I resolved it by specifying the output file:
./node_modules/.bin/ng-xi18n --i18nFormat=xmb --outFile=messages.xmb
It is 2019, when I come back to Angular, and I found this same issue. The problem is that your XLF file must have a pair of target tags for every pair of source tags. You may add those tags manually, probably by copying and pasting and renaming the source tags, or you may use this script:
https://github.com/geocarlos/angular-i18n-target-tagger

vXML if statement (DTFM only)

I have a simple yes or no question being asked in vXML 2.0. I am trying to get the user to be able to press 1 for yes, or two for 2 for no. I have looked up dozens of answers to this question, however, they all mentioned voice input only and not dtfm. I'm sure it is an obvious answer, but I am at a loss.
Here is my code
<form>
<field name="verifyinput" type="digits?minlength=1;maxlength=1">
<prompt> You entered <?php echo $_SESSION["accountnumber"]; ?>. . If that is your Account Number Press 1. Otherwise Press 2.
</prompt>
<filled>
</filled>
</field>
</form>
I am not sure what to put in the Filled tab.
For simple recognition results, you can just check the value of the field name:
<form>
<field name="verifyinput" type="digits?minlength=1;maxlength=1">
<prompt> You entered <?php echo $_SESSION["accountnumber"]; ?>. . If that is your Account Number Press 1. Otherwise Press 2.
</prompt>
<filled>
<if cond="verifyinput == '1'">
<!-- executable content -->
<prompt>You said one</prompt>
<elseif cond="verifyinput == '2'"/>
<!-- executable content -->
<prompt>You said two</prompt>
<else/>
<!-- executable content -->
<prompt>You made an invalid choice</prompt>
</if>
</filled>

ADF selectItem tag does not produce expected HTML

I'm trying to produce a simple selection in ADF. I tried something like this:
<af:selectOneChoice label="#{bindings.items.label}" id="soc1"
value="#{bindings.items.inputValue}"
required="#{bindings.items.hints.mandatory}">
<af:selectItem id="si3" value="L" label="Left"/>
<af:selectItem id="si3" value="R" label="Right"/>
</af:selectOneChoice>
According to the documentation for af:selectItem, this should produce HTML <option> tags with the same label= and value= contents as shown in the source. However, that is not what happens. The value= attributes are changed to "1", "2" (and so on), and there is a message in the log file about not being able to convert them to integers. If I change the values to "34" and "52", just to see what happens, they are still changed to "1" and "2".
The documentation clearly says that the value= attribute specifies the value to be sent to the server, and makes no mention that it should be an integer, or that the supplied value will be replaced with a new value.
Can anyone tell me what I'm doing wrong? Or is this just the way it's supposed to work?
Here's the documentation: http://jdevadf.oracle.com/adf-richclient-demo/docs/tagdoc/af_selectItem.html
You need to set the valuePassThru attribute of <af:selectOneChoice> to true. By default its set to false, which makes the values to be indices.
<af:selectOneChoice label="#{bindings.items.label}" id="soc1"
value="#{bindings.items.inputValue}"
valuePassThru="true"
required="#{bindings.items.hints.mandatory}">
<af:selectItem id="si3" value="L" label="Left"/>
<af:selectItem id="si3" value="R" label="Right"/>
</af:selectOneChoice>

Search a string in file using C language

I am getting problem with FILEs concept in C language.
My problem is I have a html file , and that was opened in read mode.
I need to get the data from that file. The acurate is i between the two strings.
The strings are "<Response>" and "</Response>".
The text file is shown below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title></head>
<body>
<form name="form1" method="post" action="pos_fis_transactions.aspx?trans=14%7c35381192%7c10-10-2011%7c1000.0%7c10-10-2011%7cCASH%7cCREDIT%7cc%7cGCC" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE3NDI1ODEyMjhkZKgy7LmL8WTr+VEeDUOifRqzISfa" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLEypqSAQKez72pDln9yKosD6kd+LvgBmdrWkYoLk2u" />
<div>
<textarea name="txtTransAck" rows="2" cols="20" id="txtTransAck">**<Response>14|245</Response>**</textarea>
</div>
</form>
</body>
</html>
In the above html file, I need to pick the data 14|25.
First of all you are not looking for <Response> and </Response> but <Resonse> and </Resonse> .
If the file is not too big, load it into memory and do a
strnstr( loadedFileContent, "<Response>", lengthOfLoadedFileContent );
This gives you a char pointer to the first & - now add strlen( "<Response>" ) to that, and you arive at your content.
Now either you know the length of your content and read it, or search from that position on for the nest & and take the string in between.
hth
Mario

How to process uploaded files in correct order?

Let's say I have the following form with 2 files:
<!-- the field below contains actual upload file -->
<input type=hidden name="http://localhost:XXXX/some_unique_name_generated_by_Picasa_and_not_controlled_by_me">
<!-- the name of field below is equal to the uploaded above filename -->
<input type=hidden name="DSC04310.jpg" value="description of first file">
<input type=hidden name="http://localhost:XXXX/some_unique_name_generated_by_Picasa_and_not_controlled_by_me">
<input type=hidden name="DSC04306.jpg" value="description of second file">
Somehow when they are uploaded, I get them on the server in different sequence - DSC04306.jpg first and then DSC04310.jpg. I use:
arguments = self.request.arguments()
files_arguments = []
for argument in arguments:
if 'localhost' in argument: # choose files only, not other fields
files_arguments.append(argument)
But I need to process them in the same sequence as they were in the form.
I think about the following solution:
<input type=hidden name="http://localhost:XXXX/some_unique_name">
<input type=hidden name="DSC04310.jpg" value="description of first file">
<input type=hidden name="seq_DSC04310.jpg" value="1">
<input type=hidden name="http://localhost:XXXX/some_unique_name">
<input type=hidden name="DSC04306.jpg" value="description of second file">
<input type=hidden name="seq_DSC04306.jpg" value="2">
Is it good approach? If so, then how can I sort values in files_arguments based on values in seq_FILENAME fields?
Don't use request.arguments(), unless you want all keys from request including keys from the query string (and not only POST). Also, it is not ordered.
Instead, iterate over request.POST values, because it is ordered. You can use request.POST.iteritems() or request.POST.itervalues():
for key, value in self.request.POST.iteritems():
# ...

Resources