« first day (3082 days earlier)      last day (1865 days later) » 

9:00 PM
The code is in his question anyway, so anyone interested can click through to that.
 
wow lol
 
I added a comment to your question that may be helpful @Jon.
@DavidKamer ? Did I say something wrong?
 
nah, just thought it was funny that you suggested people should follow the code to the trashcan rather than just reposting it and formatting it.
 
Jon
@ConspicuousCompiler Can you please check my comment . I just posted code who's generating link
 
@DavidKamer he didn't say go see the code I moved to the trash, he said go see the code in the question on SO that he posted a little higher up
 
9:11 PM
Oh, I may have been unclear @DavidKamer . I mean the code here:
0
Q: React : How to remove duplicate route name in ReactJS

JonI am working on ReactJS project . Actually , I am using React-Router 3.2.0 in my project but I have some issues in project . I am using component name as organization I defined route for organization it working fine but when I click on button to open a registration form in organization component ...

Not the trashed comment. =)
 
oh, different story then lol. I thought you were like "well, it's still somewhere gents, go find it"
 
@jon When replying to a comment requesting more information, edit the information into your answer. Don't add it as a comment.
 
Jon
@ConspicuousCompiler yes please
 
Ideally, somebody coming to the question later will be able to fully understand it by reading just the question without the comments.
 
Jon
@cons
@ConspicuousCompiler please check my question I just updated
 
9:18 PM
@jon I don't have a React environment set up to test, but I think you need to change your <Link to={item.name} to <Link to={"/" + item.name}
 
I just use <base href="/" />
to avoid needing to do that
 
Does React read the <base> tag when dynamically rewriting the history?
 
No, but the web browser does.
 
hi, why does $("#myDiv :input").valid() generates errors but its value is still true
it should be false since there are errors no?
 
What do you mean by it's value?
 
9:21 PM
How would I map over this?
"result": {
          "1scjh7": { "name": "John" },
          "2s5b1j": { "name": "Mary" },
          "5kt01p": { "name": "Bob" }
        }
 
i have an ajax call so i wanted to check if $("#myDiv :input").valid() returns false so i don't make the ajax call @KevinB
 
Right
 
@Shamaran Object.keys
 
What what do you mean by "it's value"? are you saying .valid() is returning true?
 
yes
 
9:22 PM
or is it returning an object
 
its true
 
how are you testing that?
 
spy on f12
watch
 
Jon
@ConspicuousCompiler .. Thanks! you are the best . It working !!
 
@Jon Groovy. Keep in mind that means that all links will have a leading slash. If you actually do want nested URLs using that code later, that may present a problem.
 
9:24 PM
Can you provide the code around the call to .valid?
 
var model = $("#destinationMultiple :input").serialize();
if ($("#destinationMultiple :input").valid()) {
$.ajax({
type: 'POST',
url: '@Url.Action.......
 
Thanks @DavidKamer
 
Here's the logic behind that .valid() method
	valid: function() {
		var valid, validator, errorList;

		if ( $( this[ 0 ] ).is( "form" ) ) {
			valid = this.validate().form();
		} else {
			errorList = [];
			valid = true;
			validator = $( this[ 0 ].form ).validate();
			this.each( function() {
				valid = validator.element( this ) && valid;
				if ( !valid ) {
					errorList = errorList.concat( validator.errorList );
				}
			} );
			validator.errorList = errorList;
		}
		return valid;
	},
 
so its working only on forms?
 
Jon
@ConspicuousCompiler ok , Thanks ! . Can you please set this ` <Route path="/organization/new" exact component={OrganizationForm}/>` in Main APP Route . I am trying but it give me two separate menus .. You may check Code
 
9:28 PM
no, it seems to be capable of handling both forums and collections of inputs
but...
the way it uses valid looks weird
 
@jon Afraid I've got to sign off for now. Somebody else in here may be able to help you out. Best of luck.
 
Jon
@ConspicuousCompiler ah ! no problem . Thank you BTW
 
cause it shows errors under the fields, but it still posts the object to the server side
 
are you positive it's posting using the $.ajax inside the if statment?
i assume so
 
ye
yes
i put a debugger inside
and it is reaching it
its not even the .valid() who shows the erros
its the return of the server call
inside the partialview which sees the element is empty
 
9:33 PM
Oh, then that changes things
 
i dont know how can i catch and pop the error before going to server side
 
Remove the ajax call and lets just debug the .valid call.
 
did this
var valid = $("#destinationMultiple :input ").valid();
it just contains a true
 
did the form inputs gain any error notices?
If not, then you're validation rules are likely not being applied or are incorrect
 
user1596138
How did you define the validations on your inputs?
 
9:38 PM
a dataanottation on the model
required attribute
 
user1596138
Can we see
 
[Required(ErrorMessage = "MsgErreurRequis")]
public string CheminDestination { get; set; }
 
user1596138
On the front end.
 
user1596138
.valid() runs on the front end
 
when this required with the unobstrosive jquery
puts it in the frontend
 
9:40 PM
view source
 
user1596138
What I am expecting will be similar to <input required max=5/>
 
will give you the input
 
user1596138
If you post that we have a MVCE
 
user1596138
MCVE
 
<input class="form-control" data-val="true" data-val-required="Le champ Répertoire destination est requis" id="RepertoireDestinationMultiple_0__CheminDestination" name="RepertoireDestinationMultiple[0].CheminDestination" type="text" value="qweqwe123weqweqe">
 
user1596138
9:40 PM
MECV
 
user1596138
There is no validation on that then. That would be the issue. it will always be true
 
Whats the most efficient way to go through a bunch of thing and do stuff whether some are true?
A,B,C
 
user1596138
@JBis Switch, array.includes, depends
 
map/switch
 
@Jhawins data-val-required="Le champ Répertoire destination est requis"
 
9:42 PM
You cant switch with multiple variables though, right?
 
you can switch(true), but that's disgusting
I'd just use an object
 
Go on...
 
user1596138
@tahtoh Afaik $.valid() doesn't care about that. I could be wrong
 
user1596138
Looks like you're controlling everything from ASP.net so I don't have useful advice
 
Case 1: A && B
Case 2: A && !B
Case 3: !A && B
Case 4: !A && !B
Like I dont want a bunch of ifs, I think switch(true) could work
 
9:45 PM
@tahtoh i don't see anything in the documentation that indicates the validate plugin will treat data-val-required the same as required
 
usually
when i add
Include("~/Scripts/jquery.validate*")
it starts working on the frontend
never asked myself how to be honnest
 
user1596138
@JBis Do they do anything similar in each case?
 
@Jhawins no
 
user1596138
Might be a way to conditionally send arguments and use the resulting arg instead of 4 distinct cases.
 
user1596138
Ah.
 
9:47 PM
The documentation might just be bad
It does have this example:
<input required data-msg="Please fill this field">
<input data-rule-minlength="2" data-rule-maxlength="4" data-msg-minlength="At least two chars" data-msg-maxlength="At most fours chars">
but i see no other mention of using data attributes
 
data-val-required is the error message to be displayed if a value is not provided.
 
user1596138
You could always just use HTML5 validators
 
@Jhawins interesting, how do you mean?
@Jhawins ew
 
@Jhawins
if it was on a personal project yes
but on this one i cant
 
user1596138
Thats backwards
 
user1596138
9:50 PM
I mean if this is an existing site you'd have code to copy from right? Sounds like this is new development? You know your bounds, I don't, but it sure looks like you could avoid the jQuery plugin :P
 
yes its new development
 
basically, most browsers now days support html5 input validation
<input type="text" required />
 
user1596138
@tahtoh I don't want to harp on.. But why can't you use modern tech then?
 
will prevent the form from being submitted if the input isn't filled in, and will pop up an error message informing the user something is wrong and focus the input
all the things that the jquery plugin does
 
user1596138
As well as css selectors, like :valid
 
9:52 PM
1. Browsers required messages suck
2. Easier to fix/change in future if done in JS
3. Browser support (meh)
 
it supports min/max, as well
chrome's look great
 
user1596138
Then each component (and the form itself) has a validity property
 
user1596138
You can do a bit of custom messaging... That is where it really lacks IMHO. Have to restyle psuedo elements etc to get custom validation within it
 
user1596138
I'm of the mindset that browser-default is the way to go tho. No sense customizing it. A consistent experience across the web would be nice
 
im just using what comes with the .net framework in c# atm
 
user1596138
9:54 PM
It's gonna make your life hard. But you should be able to use that if you want. Sorry the documentation sucks and I can't grasp what you need to do :P
 
WHAT do you advise me for fluid developement
 
user1596138
If you can give me a validation rule I can show you an example.
 
so its not framework related?
 
Does HTML5 validation have a solution to compound validation?
like, x is required if y is filled in, etc
 
user1596138
You have to do that by hand
 
user1596138
9:58 PM
In JS
 
user1596138
Afaik
 
user1596138
Not crazy tough. You can still call reportValidity to use the built in error messaging in such cases
 
can you custom the style of the messages yet?
 
user1596138
I don't think they are even attached to the element in the dom in any way
 
user1596138
I think it's similar to alert
 
10:02 PM
yea. chrome added a way to style them for like a version or two iirc.
but that's my only real beef.
I know you can just eliminate that, but it would be so nice to leverage it and style it yourself.
 
@Jhawins added the required attribute now the valid is false but it shows the element in red without showing the message under it
which i usually have
 
user1596138
Yeah I think you were getting that from jQuery earlier
 
user1596138
Now you won't get the jQ one
 
lol
 
user1596138
I don't like this example but it will show you what others are doing. It's enough to accomplish it jsfiddle.net/tj_vantoll/9ky8Z
 
user1596138
10:04 PM
That is avoiding the browser message altogether but using the html5 validation for state
 
user1596138
At their line 10 they do the custom element additions..
 
user1596138
If you replace that block with
 
user1596138
if ( !this.validity.valid ) {
    this.reportValidity();
}
 
user1596138
You'll start getting native browser messaging.
 
what do you mean by native browser messaging
 
user1596138
 
user1596138
On Chrome it will say "Please fill out this field." by default. The messaging you see is the native validation-bubble
 
i dont want that to happen
 
user1596138
Just a thought man. No sense digging into this hole if you want to do it another way
 
user1596138
The original example shows you how to do literally anything you want during the validation :P
 
user1596138
I've done it a dozen ways in my tenure. Today if I made a React app or similar I would use HTML5 validations. Just my opinion
 
10:12 PM
did this
@Html.TextBoxFor(model => model[i].CheminDestination, new { @class = "form-control", @required = "Email is required.", @data_required_message = "Email is required." })
but still not working
 
user1596138
I'll never write front end from ASP.net :P
 
user1596138
!!afk BF5 or Blackout
 
peace
thanks again
 
11:08 PM
@rlemon ok 6-8 weeks, deal
it's been seven
don't make me call your parents
 
😃
my mom would be so confused. then probably tell you off for bugging her
 
hahahaha
 
11:41 PM
You can always call my parents, then I don't have to do it.
 

« first day (3082 days earlier)      last day (1865 days later) »