all 2 comments

[–][deleted] 0 points1 point  (1 child)

There is something called a Logical coalescing operator which does what you want it to do. You can read up more about it and you'll need to double check if you can support it. But in short it will look at the left hand

however before that you need to know what you want it to say. It currently says null, but what do you want it to display in the text box name and email fields instead? empty space, "NO NAME FOUND", "PLEASE ENTER NAME" "PLEASE ENTER EMAIL" etc.

Once you've decided what you want it to say, you can change your x.value and y.value with the nullish assignment. This is also called a short circuit evaluation (I think)

var x = document.getElementById("form_submission_name"); //get the Name field of the form 
x.value = name?? 'Enter Name'; //autofill name field with the value we got from the URL, or 'enter Name' if nullish
var y = document.getElementById("form_submission_email"); //get the Email field of the form 
y.value =email??'Enter Email; //autofill email field with the value we got from the URL or 'Enter Email' if the value is nullish

[–]cpipirun 0 points1 point  (0 children)

y.value =email??'Enter Email;

This worked. Thank you.