Jump to content

Recommended Posts

Posted (edited)

I have 2 different \IPS\Helpers\Form\Node on the same form. Both use the same class of node and have only class set and a default value.

Somehow it is messing one up where it just says "Select" and does not have the default option selected from it, even though I confirmed the correct values.

In fact I can even put just ONE Node input on the form and sometimes it has this problem. It did not do this before 4.5.

the code is as simple as this:

		$form->add( new \IPS\Helpers\Form\Node( 'pickemsx_away_team', $game ? $game->team_two_id : NULL, TRUE, array( 'class' => '\IPS\pickemsx\Pickem\Team' ) ) );

I even changed that default to a hardcoded 11 in both inputs and one worked and one didn't even though they used the SAME DATA.

I confirmed that it is fixed when overwriting IPS\System\Node\Model.php with the 4.4 version of the file. I have spent a lot of time and unable to track down the bug from that file. My guess is it's in function roots(). Obviously, some change in 4.5 caused this and even though I could just change it to a Select and put the node names in that instead, the Node input was so convenient. 😞 

Edited by Midnight Modding
Posted (edited)

Wow. I found out the problem. Check this out for one weird fix. Guess what caused it? Me not knowing I needed to add , $limit = NULL into my model's nodesWithPermission(). Somehow that caused some inputs to have nothing selected, yet they were all still right there in the selector... How in the world that caused it to sometimes work and sometimes not work for the exact same data and default value beats me.

Only way i realized it is I was messing around to see if putting the loaded node as the default value instead of just its id would fix it. When I did that it threw the exception due to me not having $limit.

So i guess it's not a bug, although it's still weird how it only sometimes happened and I wish it had said in the changelog we needed to add that parameter.

Edited by Midnight Modding
Posted

whyIDEsMatter.thumb.png.f67d1ded8c0dd6739cf491787a5ae2b1.png

using an IDE with the proxyclass generator, it will tell you when method signatures change from a parent class, here it puts a squiggly line under the method and when i focus on it, it will tell me its no longer compatible with the parent.

Phpstorm is an excellent IDE, its very reasonably priced (they offer yearly or monthly subscriptions, and they also offer loyalty discounts. after 3 years phpstorm will be as little as $5 a month or around $50 a year. note: i'm not affiliated with jetbrains, i'm just a crazed fanboi of their products).

if you don't want to pay for one, there are a few opensource free ones like eclipse or VS Code (if you are afraid MS tracking you thru telemetry which VS Code has, you can opt for the VS Codium which removes all that but still remains compatible with VS Code plugins), and if you are really masochistic, there is netbeans and sublime. note: vs code/sublime aren't true IDE's, they are more advanced text editors that thru plugins you can emulate IDE features, netbeans and eclipse are IDE's, but they all vary in ability and features. 

Posted
6 hours ago, CodingJungle said:

whyIDEsMatter.thumb.png.f67d1ded8c0dd6739cf491787a5ae2b1.png

using an IDE with the proxyclass generator, it will tell you when method signatures change from a parent class, here it puts a squiggly line under the method and when i focus on it, it will tell me its no longer compatible with the parent.

Phpstorm is an excellent IDE, its very reasonably priced (they offer yearly or monthly subscriptions, and they also offer loyalty discounts. after 3 years phpstorm will be as little as $5 a month or around $50 a year. note: i'm not affiliated with jetbrains, i'm just a crazed fanboi of their products).

if you don't want to pay for one, there are a few opensource free ones like eclipse or VS Code (if you are afraid MS tracking you thru telemetry which VS Code has, you can opt for the VS Codium which removes all that but still remains compatible with VS Code plugins), and if you are really masochistic, there is netbeans and sublime. note: vs code/sublime aren't true IDE's, they are more advanced text editors that thru plugins you can emulate IDE features, netbeans and eclipse are IDE's, but they all vary in ability and features. 

I am so slow to change. lol. I need to finally switch over to something. I did try some of those in the past and was so in a habit of the basic text editor... I bet once I make myself stick with one of those, I will be in shock how much easier it makes things for me.

Still confusing, though, how that change made it where only some inputs had the issue and all nodes showed up fine in the selector even then, just sometimes not one selected. I would have expected every one to have the issue when there was a problem with that method in the class. Pretty odd, but not worth me going through figuring out why.

Posted
8 minutes ago, Midnight Modding said:

Still confusing, though, how that change made it where only some inputs had the issue and all nodes showed up fine in the selector even then, just sometimes not one selected. I would have expected every one to have the issue when there was a problem with that method in the class. Pretty odd, but not worth me going through figuring out why.

it was probably silently failing inside the node helper, if you don't have php setup to show errors or have overridden it via ini_set or in htaccess. 

Posted (edited)
1 hour ago, CodingJungle said:

it was probably silently failing inside the node helper, if you don't have php setup to show errors or have overridden it via ini_set or in htaccess. 

yeah, but it wasn't always doing it. I even put two node inputs with the exact same node class and default value and one worked and one didn't and sometimes when putting 2 different ones on a form neither would work and sometimes one would and one wouldn't. I think usually the second one worked and the first one didn't, but even that was not the case every time.

(note: I am not saying reloading the same page would cause differences sometimes, I mean when using different defaults...)

Edited by Midnight Modding
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...