How to block typing characters and letters into a number-only input in a Vue V-validate form - vee-validate

How to block typing characters and letters into a number-only input in a Vue V-validate form?, this is the field of the form in question:

Only change the type="number" so that it does not support typing letters or characters:
...
...

Related

Unescaped Text with th:placeholder

In the current spring-boot / thymeleaf, some of the html views have a form where a field with like this is present:
<input type="text" name="sobrenome" class="form-control" th:placeholder="#{account.sobrenome}"/>
the value for account.sobrenome is placed on file message.properties:
account.sobrenome=Último nome
the problem is the application don't resolve the Ú to Ú. When I use th:utext, i have no problems with this.
Anyone know how to use unescaped text with this tag th:placeholder?
The issue is Spring Message treat &Uacute as seperate & U a c u t e letters and not as Ú.
Change the message to unicode as below
account.sobrenome=\u00daltimo nome
and use
th:placeholder="#{account.sobrenome}"

Codigniter replace dots in my input names with underscores

When I submit a form, Codigniter replace input names containing dots (.) with underscores (_). Here is a simple example:
<form method="post">
<input type="text" name="client.firstname" />
<input type="text" name="client.lastname" />
<input type="submit" />
</form>
$_POST contains now:
Array
(
[client_firstname] => xxxxx
[client_lastname] => yyyyy
)
So client.firstname became client_firstname with no reason?!
Do you have any idea of what is happening?
That is not CI doing this, but PHP itself – and it is a remnant of the “olden days” before there were $_POST/$_GET/etc., when external parameters where imported into the global variable scope directly; because variable names can not contain a . in PHP, because that is also the concatenation operator.
And this is documented as well, http://php.net/manual/en/language.variables.external.php:
Note:
Dots and spaces in variable names are converted to underscores. For example <input name="a.b" /> becomes $_REQUEST["a_b"].

get form values other than by name in codeigniter

hi i am using codeigniter . i have a form , there i add hidden fields dynamically . so every hidden field is <input type='hidden' name='hidden' value="+$(this).attr('title')+"> so the name is equal .
the problem is when i submit the form and try to get my hiden field values i can only get one hidden field value , because the names are same
i print my form values
print_r($this->input->post());
i have 2 hidden fields but i get only one
Array
(
[hidden] => march
[textbox] => march
[mysubmit] => Submit
)
i can change the name dynamically of hidden field when creating , but then i don't know exactly the name of my hidden field ,
how can i get hidden field values with same name ?? is there any way to get form values other than by name ?? i tried and can not find an answer , please help .............
You'll need to use brackets in your name attributes:
<input type='hidden' name='hidden[]'>
<!-- ^^^^ -->
This will allow PHP to accept multiple inputs with the same name as an array of values, so in this case, $_POST['hidden'] will return an array of strings.
By default they are indexed starting at 0, so $_POST['hidden'][0] will get you the first one, $_POST['hidden'][1] will get you the second, etc., however - you can explicitly index them if it's easier for you, either with numbers or strings.
<input type='hidden' name='hidden[first]'>
<input type='hidden' name='hidden[second]'>
Or:
<input type='hidden' name='hidden[0]'>
<input type='hidden' name='hidden[1]'>
You can nest these as deep as you want like hidden[first][1][], and they will be treated similarly to a PHP array when you get the $_POST values, but you need the brackets in the HTML.
Without brackets, only the last field's value will be available in the $_POST array. This is a PHP feature, Codeigniter can't do anything about it.

Custom ValidationTextBox in Dojo

I am new to Dojo programming and trying to create a ValidationTextBox for username input. I would like to have three criteria: 1. users can only input alphanumeric characters and 2. minimum length of a username is 6 character 3. this field is required
So far my input looks like:
<input name="username"
type="text"
id="username"
class="reqd1"
required="true"
trim="true"
lowercase="true"
promptMessage="Username"
invalidMessage="Please only enter alphanumeric characters."
maxlength="12"
regExp="[\w]+"
intermediateChanges="false"
dojoType="dijit.form.ValidationTextBox" />
I have three questions:
1. how I can check for the the minimum character of the username field?
2. Is there a way to change the invalidMessage programatically?
3. How I can check the length of the username field without using regEx?
regExp="\w{6,12}"
dijit.byId("username").set("invalidMessage", "new message");
I think regExp is the best way in your case

(ruby) help matching my regular expression

I am trying to match the value of the following HTML snippet:
<input name="example" type="hidden" value="matchTextHere" />
with the following:
x = response.match(/<input name="example" type="hidden" value="^.+$" \/>/)[0]
why is this not working? it doesn't match 'matchTextHere'
edit:
when i use:
x = response.match(/<input name="example" type="hidden" value="(.+)" \/>/)[0]
it matches the whole html element, and not just the value 'matchTextHere'
^ matches start of a line and $ matches end of the line. Change ^.+$ to \w+ and it will work for values that doesn't contain any symbols. Make it a parenthetical group to capture the value - (\w+)
Update: to match anything between the quotes (assuming that there aren't any quotes in the value), use [^"]+. If there are escaped quotes in the value, it is a different ballgame. .+ will work in this case, but it will be slower due to backtracking. .+ first matches upto the end of the string (because . matches even a "), then looks for a " and fails. Then it comes back one position and looks for a " and fails again - and so on until it finds the " - if there was one more attribute after value, then you will get matchTextHere" nextAttr="something as the match.
x = response.match(/<input name="example" type="hidden" value="([^"]+)" \/>/)[1]
That being said, the regex will fail if there is an extra space between any of the attribute values. Parsing html with regex is not a good idea - and if you must use regex, you can allow extra spaces using \s+
/<input\s+name="example"\s+type="hidden"\s+value="([^"]+)"\s*\/>/
Because you have a start-of-line token (^) and an end-of-line token ($) in your regular expression. I think you meant to capture the value, this might solve your problem: value="(.+?)".
Beware, though, that processing html with regular expressions is not a good idea, it can even drive you crazy. Better use an html parser instead.
You don't need the ^ and $:
x = response.match(/<input name="example" type="hidden" value=".+" \/>/)[0]
you just need to change [0] to [1]
response='<input name="example" type="hidden" value="matchTextHere" />'
puts response.match(/<input name="example" type="hidden" value="(.*?)" \/>/)[1]
matchTextHere

Resources