Can we clear input boxes in fixlet description fields?

Using the JS code below I generate these input fields in my fixlet:
image

However, as you can see from the image, values are retained in the input boxes. I would like to have them cleared to prevent inadvertent re-use. Can this be done? As you can see in the code below I have tried initializing the values via the “initForm” function with no success. I have also tried calling this function via “window.onload = initForm”, also with no success. Can we clear these values via some other means or is that not possible?

I can’t test now, but I don’t think you can override the window.onLoad function.

Just a guess, but can you try adding value="" to the HTML controls on the form?

As in
<input id='password' name='password' type='password' value=''>

1 Like

Just tried that based on your suggestion, no go :frowning:

Would have been great if it were that simple though!

I found a viable method, it may be somewhat inefficient but does work. Using “setInterval” in java script sets up a loop where I can call a function every X milliseconds. While this is not optimal it is functional. I would greatly prefer if we could natively select to retain or not retain values.

In this small javascript snippet I create a function to set my form values. This could set them to a default value or just assign an empty value as I do below. Then I set an interval timer to call this function every X milliseconds. In the snippet below I call it every 300000 milliseconds (5 minutes). In this manner a user who may be repeatedly deploying the fixlet with slightly varying values would have their entries retained for up to 5 minutes.

The 2 down sides to this are 1) it is always running and 2) It can catch a user in the middle of input. for example if it were open on their screen for 4:55 seconds when they start typing it will clear the form in 5 seconds forcing them to re-enter the values.

However I feel that in this particular use case, where retained form data could be negatively impact the targets, these down sides are acceptable.

I would LOVE to hear other ideas if they are out there :slight_smile:

function initForm() {
    				// Clear forms here
    				document.getElementById("division").value = "";
    				document.getElementById("application").value = "";
    				document.getElementById("environment").value = "";
    				document.getElementById("password").value = "";
    				}		
setInterval(function(){ initForm()},300000);

Here is a larger example, shown in the exported .bes xml format:

<Fixlet>
		<Title>FORM EXAMPLE</Title>
		<Description><![CDATA[<BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr>

<script>
			function initForm() {
				// Clear forms here
				document.getElementById("division").value = "";
				document.getElementById("application").value = "";
				document.getElementById("environment").value = "";
				document.getElementById("password").value = "";
				}            			
			setTimeout(function(){ initForm()},1);
		
		
                document.body.ontakeaction = function() {
                    var theDivision = document.getElementById( "division" ).value;
		        var theApplication = document.getElementById( "application" ).value;
	                var theEnvironment = document.getElementById( "environment" ).value;
			var thePassword = document.getElementById( "password" ).value;
																   
			if (theDivision==null || theDivision=="")
			   {alert("Hey, you forgot to enter a Division! Please enter one on the Description tab before taking the action.");}	
			else if (theApplication==null || theApplication=="")
			   {alert("Hey, you forgot to enter an Application! Please enter one on the Description tab before taking the action.");}
			else if (theEnvironment==null || theEnvironment=="")
			   {alert("Hey, you forgot to enter an Environment! Please enter one on the Description tab before taking the action.");}
			else if (thePassword==null || thePassword=="")
			   {alert("Hey, you forgot to enter the password! Please enter one on the Password tab before taking the action.");}
                   else
		          {TakeSecureFixletAction( Relevance('id of current fixlet'), Relevance('id of current bes site'), "Action1", {}, { Division: theDivision, Application: theApplication, environment: theEnvironment, password: thePassword } );}
                    return false;
                  }
</script> 
<table border=0>
<tr><td><LABEL for=division>Division:</LABEL></td><td> <INPUT id=division name=division value="default"> </td></tr>
<tr><td><LABEL for=application>Application:</LABEL></td><td> <INPUT id=application name=application > </td></tr>
<tr><td><LABEL for=environment>Environment:</LABEL></td><td> <INPUT id=environment name=environment > </td></tr>
<tr><td><LABEL for=password>Password:</LABEL></td><td> <INPUT id=password type=password name=password > </td></tr>
</table>
</P></BLOCKQUOTE>

Paging doctor @jgstew

1 Like

why not add a reset button?

<button onclick="initForm()">Reset</button>

Kevin,

Thanks for the suggestion. I had considered that, however it is functionally the same as the users inputting data into the form fields. In any case they would be required to take some sort of preventative action. Since we know attention to detail declines with familiarity, I doubt it would, in the end, provide the requested protection.

FWIW, there are also browser events (onclick, onfocus, etc) which can be used to clear the fields too, but again, it depends on the user taking some action :frowning:

It would be nice if there was a native way to retain or clear values, a checkbox in the fixlet or some other method.

Hey @chadmjohn – its still not clear to me the condition under which you would like the form fields cleared or populated.

It looks like you wanna populate these fields via some session relevance that gets run in the fixlet description.
Maybe what you’re thinking about is placeholder text?

<input type="text" placeholder="some placeholder text"/>

That placeholder text can be displayed without holding the place of the actual values.

It would be nice if there was a native way to retain or clear values, a checkbox in the fixlet or some other method.

We do have a way to store stuff - like

StoreVariable( dashID, "ShowFooSetting", "Yes", true );  // stores a variable to the dashbaord datastore

then you grab it via session relevance like:

shared variable "ShowBarSetting" of current wizard

So maybe you can populate a dropdown of these guys and some way to save current – I mean sky’s the limit. You can get as complex as you want.

The problem is that we do not want to save values from the last execution. Unfortunately in the fixlets once a value is populated via a dropdown, text entry, etc. it retains that setting.

The only way to clear it is on some event (browser action). Adding a default value, placeholder, etc are fine on the first execution. Once altered they retain the altered value.

Ahh so maybe this is more of a IE setting issue?

Did you try changing privacy settings for form auto-fill?

Something described here https://support.microsoft.com/en-us/help/17499/windows-internet-explorer-11-remember-passwords-fill-out-web-forms

Interesting idea, I had not tried that. I did try adding browser directives to not cache page data but since we cannot add metadata above the portion of the “page” in a fixlet that did not work.

I’ll check out browser settings but it could still be problematic as that is based on something that will be outside of my control.

Also found this one

<input type="text" name="" value="" autocomplete="off" />

(from https://stackoverflow.com/questions/2530/how-do-you-disable-browser-autocomplete-on-web-form-field-input-tag/38333163)

1 Like