dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26282
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13025: check duplication for sms command's codes
------------------------------------------------------------
revno: 13025
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-11-26 16:42:54 +0700
message:
check duplication for sms command's codes
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm 2013-11-26 03:39:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm 2013-11-26 09:42:54 +0000
@@ -6,7 +6,7 @@
validation( "updateSMSCommandForm" );
var selectedDataOptions = '{"codes":[';
- //$("#codes label").each(function(){
+ //$("#codes input").each(function(){
//selectedDataOptions += '{"dataElementId" :' + $(this).attr('value').split('.')[0] + ',';
//selectedDataOptions += '"optionId" :' + $(this).attr('value').split('.')[1] + ',';
//selectedDataOptions += '"code" :"' + $(this).val() + '"},';
@@ -31,6 +31,26 @@
$("#specialCharactersInfo").val(specialCharactersInfo);
$("#updateSMSCommandForm").submit();
};
+
+ function checkDuplicatedCode( value, index )
+ {
+ for (var i=1; i<=jQuery('.trDataElementCode').length; i++ )
+ {
+ if ( i != index )
+ {
+ var otherValue = document.getElementById('codeValue'+i).value;
+ if( value!='' && value == otherValue )
+ {
+ markInvalid( 'codeValue'+index, 'Duplicated Value' );
+ break;
+ }
+ else
+ {
+ markValid( 'codeValue'+index );
+ }
+ }
+ }
+ };
</script>
@@ -50,7 +70,7 @@
</tr>
<tr>
<td>$i18n.getString( "name" )</td>
- <td><input type="text" name="name" id="name" value="$smsCommand.name" style="width:20em" class="validate" /></td>
+ <td><input type="text" name="name" id="name" value="$smsCommand.name" style="width:20em" class="{validate:{required:true}}" /></td>
</tr>
<tr>
<td>$i18n.getString( "parser" )</td>
@@ -123,9 +143,9 @@
$dataElement.name $x.name
</td>
<td>
- <input type="hidden" id="codeId$index" name="codeId$index" value="$dataElement.id.$x.id"/>
- <input type="text" id="codeValue$index" name="codeValue$index" class="{validate:{required:true}}" value='$!codes[$str]' class="validate"/>
- </td>
+ <input type="hidden" id="codeId$index" name="codeId$index" value="$dataElement.id.$x.id"/>
+ <input type="text" id="codeValue$index" name="codeValue$index" class="{validate:{required:true}}" value='$!codes[$str]' onblur="checkDuplicatedCode(this.value, $index)"/>
+ </td>
</tr>
#end
#else