My goal is to automatically fill in the "Reason for Access" text box with the word "TEST" using Tampermonkey. I am new to using Tampermonkey and UserScript, so I appreciate your patience.
Currently, I am facing an issue where the "Reason for Access" field remains empty and does not submit automatically.
Could you please help me troubleshoot this problem? Let me know if you require any additional information.
Here is my userscript:
function ClickURL2() {
var FillF2 = document.getElementsByName("reason");
FillF2[0].value = "TEST";
var FormSub = document.getElementsByName("crm-info crm-dialogue");
FormSub[0].submit();
}
Below is the source code of the webpage:
<form name="profileForm">
<fieldset>
<div class="labelGroup">
<div class="crm-legend">
<span class="required" title="Required">*</span> = Required<br>
<span class="audited" title="Available to Gatekeeper Users">†</span>
= Available to Gatekeeper Users
</div>
<div class="crm-form-container">
<div class="crm-profilefield">
<div class="field-label">
<span class="audited" title="Available to Gatekeeper Users">†</span>
<span class="required" title="Required">*</span>
Reason for Access</div><div class="field-input">
<input class="" type="text" name="reason" required="required" title="" style="">
</div>
<div class="ui-helper-clearfix"></div></div><input type="submit" class="hidden" style=""></div>
</div>
</fieldset>
</form>