Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REPORT-495: Added an onkeyup event to the Widgets and Text input elem… #205

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion omod/src/main/webapp/run/runReportForm.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@ jQuery(document).ready(
function toggleInputElements( idPrefix ){
jQuery( '.'+idPrefix ).toggle();
}

/**
* TODO make disableButtons(idPrefix) an external function so that when widgets are
* used elsewhere but not in the Reporting module, they can access it.
*/
var disableButtons = function(idPrefix) {
var checkFixedValue;
checkFixedValue = jQuery('.' + idPrefix).val().length;
var checkExpression;
checkExpression = jQuery('#inputExpression.' + idPrefix).val().length;

if (checkFixedValue > 0 || checkExpression > 0) {
jQuery('.' + idPrefix + '.smallButton').attr("disabled", "disabled");
} else if (checkFixedValue == 0 || checkExpression == 0) {
jQuery('.' + idPrefix + '.smallButton').removeAttr("disabled");
}
}
</script>

<style>
Expand Down Expand Up @@ -64,7 +81,8 @@ function toggleInputElements( idPrefix ){
<wgt:widget id="userEnteredParam${parameter.name}" name="${status.expression}" type="${parameter.type.name}" defaultValue="${status.value}" attributes="${parameter.widgetConfigurationAsString}"/>
<c:if test="${fn:contains(expSupportedTypes, parameter.type.name)}">
<spring:bind path="expressions[${parameter.name}]">
<input class="userEnteredParam${parameter.name}" type="text" name="${status.expression}" value="${status.value}" style="display: none" />
<!-- TODO create a unique id attribute for input in the place of #inputExpression -->
<input id="inputExpression" class="userEnteredParam${parameter.name}" type="text" name="${status.expression}" value="${status.value}" style="display: none" onkeyup="disableButtons('userEnteredParam${parameter.name}')"/>
<span onclick="toggleInputElements('userEnteredParam${parameter.name}')">
<input class="userEnteredParam${parameter.name} smallButton" type="button" value='<spring:message code="reporting.Report.run.enterExpression"/>' style="width:100px;"/>
<input class="userEnteredParam${parameter.name} smallButton" type="button" value='<spring:message code="reporting.Report.run.enterFixedValue"/>' style="display:none; width:100px;" />
Expand Down