Jars
03/07/2024, 8:07 AMerictgrubaugh
03/07/2024, 2:49 PMJars
03/07/2024, 3:13 PM<div class="container-fluid" style="">
<!-- Buttons -->
<div class="row">
<div class="col-sm">
<nav class="navbar navbar-dark bg-dark">
<form action="" enctype="multipart/form-data" method="POST" class="form-inline">
<div class="form-group row" style="padding: 20px">
<input class="form-control col-sm-6" type="search" name="workordername" placeholder="${strWorkOrderName}" aria-label="Search" />
<div class="col-sm-1"></div>
<input class="form-control text-start" type="text" name="action" id="search_action" value="search" hidden>
<button class="btn btn-outline-light col-sm-4" type="submit">
Search
</button>
</div>
<div class="form-group row" style="padding: 20px">
<input class="form-control text-start" type="text" name="action" id="clear_action" value="clear" hidden>
<button class="btn btn-outline-light" type="submit">
Clear
</button>
</div>
</form>
</nav>
</div>
</div>
Suitelet:
const onRequest = (scriptContext) => {
try {
log.audit({ title: "Method", details: scriptContext.request.method });
let objParams = scriptContext.request.parameters;
log.audit({ title: "objParams", details: { objParams } });
if (scriptContext.request.method === "GET") {
//
} else {
let strAction = objParams.action;
}
} catch (e) {
log.error({ title: "Error", details: JSON.stringify(e) });
}
};
From here, strAction will always be of value "search" regardless if I clicked the "Clear" submit button. Adding value="clear" or value="search" on the button sharing the same name="action", still gets the value of the first name="action"erictgrubaugh
03/07/2024, 3:22 PMform
, so I'm guessing you're seeing this behavior because you have nested `form`s. You can try giving your `form`s an id
, then adding the form
attribute to your `button`s.
<form id='form1'>
<button form='form1'>
Jars
03/07/2024, 3:23 PMerictgrubaugh
03/07/2024, 3:37 PMtype
and submitting the forms "manually" in the button click handlerserictgrubaugh
03/07/2024, 3:39 PMJars
03/08/2024, 11:30 AM