0

I have a back-end widget form that I developed as part as a word-press plugin. However, the alert boxes are not at all working and I am confused why. This is a default install of the latest WP with the standard theme that comes with a new installation. My widget is located at:

http://codesupport.shalomisrael.org/wp-content/plugins/carousel_edit_url_for_newspro_201709181655.zip

Please help!

Debugging steps:

1) Started with a fresh installation of the latest version of WordPress with GoDaddy Shared hosting, and loaded just the one plugin => issue persists that the alert boxes are not showing the expected values. 2) Got an example code from w3schools.com located at simpletest.com at the main web-domain. I can only include 2 links with my current status. 3) Took a screenshot of the issue. Basically the value is not being recorded correctly as follows:

[Screenshot of the drop down not working issue] https://codesupport.shalomisrael.org/DropDownBugScreenShot201709191216.jpg

6
  • downvoted as questions should be self contained, and in case of "S is not working" also a description of what debuging steps have you done. please edit and improve the question – Mark Kaplun Sep 18 '17 at 14:29
  • The picture link "Screenshot of the drop down not working issue" is not giving access to the picture currently: [2]: codesupport.shalomisrael.org/… – Stephen Elliott Sep 19 '17 at 9:28
  • If you need login credentials, please let me know, for the test site. The test site codesupport.shalomisrael.org is just for debugging purposes. Also, I tested codesupport.shalomisrael.org/simpletest.html which works as expected. The sourcecode can be retrieved in Firefox 55.0.3 with the menu Tools -> Developer -> Web Source (Control-U) – Stephen Elliott Sep 19 '17 at 12:38
  • For whoever posted a negative vote for the question, please let me know why. I want to continue to improve the question so that it only receives positive votes if at all possible. – Stephen Elliott Sep 19 '17 at 13:51
  • I updated the test site with the working solution now. So if you want to see the problem again, you would need to start with a fresh WordPress installation and add my plugin referenced above – Stephen Elliott Sep 19 '17 at 13:55
1

I changed the name of the back-end widget reference to "carousel_edit_url_for_newspro/backendwnisoform.php" in order to isolate the problem down to its essentials.

The code below works, praise G-d. I should then be able to use this sort of code in the main stream of the program development to get the drop-down menus to work fine, G-d willing:

?><br>
<select id="<?php echo esc_attr( $this->get_field_id( 'myselect' ) ); ?>" onchange="myFunction126(this.id, this.value)">
<option value="Audi">Audi
<option value="BMW">BMW
<option value="Mercedes">Mercedes
<option value="Volvo">Volvo
</select>

<p id="<?php echo esc_attr( $this->get_field_id( 'mydemo' ) ); ?>">Hi There!</p>

<script type="text/javascript">
function myFunction126(thisid126, thisvalue126) {
var x126 = document.getElementById(thisid126).value;
var y126 = thisvalue126;
document.getElementById(id="<?php echo esc_attr( $this->get_field_id( 'mydemo' ) ); ?>").innerHTML 
= "You selected: " + x126;
alert ("New selection!  x126 = " + x126 + " and y126 = " + thisvalue126);
}
</script>

For those wanting the latest script that was working correctly (just on this one issue isolated out), it is available from:

Zip file containing the plugin with the one element working just fine

5
  • Note the use of onchange="myFunction126(this.id, this.value)" with both the id and value being passed. I remember encountering problems if the id and the value were not both passed. Be careful with this. It should not be that difficult to program this stuff, but it currently feels like a bridge over uncharted waters. – Stephen Elliott Sep 19 '17 at 13:54
  • If your problem is solved, please mark your answer as accepted and avoid changing the title to something like "Resolve! - Title". – Jack Johansson Sep 26 '17 at 10:58
  • I am not seeing the ability for me to mark the answer as accepted when I answer my own question. How is that done? – Stephen Elliott Sep 28 '17 at 13:54
  • There is a gray checkbox under the vote counts for your answer (left top of the answer). You will be able to mark it as accepted 24 hours after you post your answer. – Jack Johansson Sep 28 '17 at 14:19
  • I see a gray check box, and I clicked it. Thank you for the help Jack! – Stephen Elliott Oct 2 '17 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.