Validating table rows in a LiveCycle form - livecycle

I am developing a LiveCycle form that has a table on it that can have a variable amount of rows. I want to only validate it if there is data in one of the columns but not all of them. So I would skip the validation if the row is blank or all the columns in that row are filled in.
Any ideas how to do this. How would I loop through the rows of a table.
Thanks in advance,
Paul

I would tweat your answer a little bit by replacing resolveNodes that is quite slow.
In order to get row count you can use instanceManager TrainerForm._TrainerTable.count
To get a specific item from row list use <RowName>.all.item(index). Be carefull while using this construct because it requires a least one row. Row is a shourtcat for Row[0].
Here is your code with with my upgrades:
var rowCount = TrainerForm.TrainerTable._TrainerData.count;
for (var i=0;i<rowCount;i++)
{
if (TrainerForm.TrainerTable.TrainerData.all.item(i).TrainerName.rawValue == null &&
TrainerForm.TrainerTable.TrainerData.all.item(i).TrainerPrepHrs.rawValue == null &&
TrainerForm.TrainerTable.TrainerData.all.item(i).TrainerArea.selectedIndex == -1 &&
TrainerForm.TrainerTable.TrainerData.all.item(i).TrainerActivity.rawValue == null )
;//check the case where all rows are blank which is valid
else
{
if (TrainerForm.TrainerTable.TrainerData.all.item(i).TrainerName.rawValue == null)
{
TrainerTableValid = false;
TrainerForm.TrainerTable.TrainerData.all.item(i).TrainerName.ui.#textEdit.border.fill.color").value = "255,0,0";
}
if (TrainerForm.TrainerTable.TrainerData.all.item(i).TrainerPrepHrs.rawValue == null)
{
TrainerTableValid = false;
TrainerForm.TrainerTable.TrainerData.all.item(i).TrainerPrepHrs.ui.#numericEdit.border.fill.color").value = "255,0,0";
}
if (TrainerForm.TrainerTable.TrainerData.all.item(i).TrainerArea.selectedIndex == -1)
{
TrainerTableValid = false;
TrainerForm.TrainerTable.TrainerData.all.item(i).TrainerArea.ui.#choiceList.border.fill.color").value = "255,0,0";
}
if (TrainerForm.TrainerTable.TrainerData.all.item(i).TrainerActivity.rawValue == null)
{
TrainerTableValid = false;
TrainerForm.TrainerTable.TrainerData.all.item(i).TrainerActivity.ui.#textEdit.border.fill.color").value = "255,0,0";
}
}
}

You can put your script in validate event of your cells or whole row. The result of validation script is determined by the last line result (true or false); To make validations failure visible you can set form level validation (File->Form Properties->Form Validation->Color Failed Fields).
Another approach (that I personally prefer) is setting field as required using code fieldName.manadatory = "error" when some conditions are met. In order to make field optional just put fieldName.manadatory = "disabled".

Here is what I ended up doing. First I made all fields optional. Then I execute this code from a click event of a button.
var fields = xfa.resolveNodes("TrainerForm.TrainerTable.TrainerData[*]");
for (var i=0;i<fields.length;i++)
{
if (TrainerForm.TrainerTable.resolveNode("TrainerData[" + i + "]").TrainerName.rawValue == null &&
TrainerForm.TrainerTable.resolveNode("TrainerData[" + i + "]").TrainerPrepHrs.rawValue == null &&
TrainerForm.TrainerTable.resolveNode("TrainerData[" + i + "]").TrainerArea.selectedIndex == -1 &&
TrainerForm.TrainerTable.resolveNode("TrainerData[" + i + "]").TrainerActivity.rawValue == null )
;//check the case where all rows are blank which is valid
else
{
if (TrainerForm.TrainerTable.resolveNode("TrainerData[" + i + "]").TrainerName.rawValue == null)
{
TrainerTableValid = false;
xfa.resolveNode("TrainerForm.TrainerTable.TrainerData[" + i + "].TrainerName.ui.#textEdit.border.fill.color").value = "255,0,0";
}
if (TrainerForm.TrainerTable.resolveNode("TrainerData[" + i + "]").TrainerPrepHrs.rawValue == null)
{
TrainerTableValid = false;
xfa.resolveNode("TrainerForm.TrainerTable.TrainerData[" + i + "].TrainerPrepHrs.ui.#numericEdit.border.fill.color").value = "255,0,0";
}
if (TrainerForm.TrainerTable.resolveNode("TrainerData[" + i + "]").TrainerArea.selectedIndex == -1)
{
TrainerTableValid = false;
xfa.resolveNode("TrainerForm.TrainerTable.TrainerData[" + i + "].TrainerArea.ui.#choiceList.border.fill.color").value = "255,0,0";
}
if (TrainerForm.TrainerTable.resolveNode("TrainerData[" + i + "]").TrainerActivity.rawValue == null)
{
TrainerTableValid = false;
xfa.resolveNode("TrainerForm.TrainerTable.TrainerData[" + i + "].TrainerActivity.ui.#textEdit.border.fill.color").value = "255,0,0";
}
}
}

Related

Loop through specific columns and setting value

I have a script but it works pretty slow and Im trying to see if I could make it work faster by possibly making it loop through the columns 10,12,15,17,20,22,25,27,30,32,35,37,40,42,45,47,50,52,55,57 instead of writing an if statement for each column. The way I currently have it works but it's slow and looks like this
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "Student Data-NEA" ) { //checks that we're on the correct sheet
var r = s.getActiveCell();
if( r.getColumn() == 10 && r.getValue() == 'P') { //checks the column
var nextCell = r.offset(0, 1);
//if( nextCell.getValue() !== '' ) //is empty?
nextCell.setValue("P- N/A");
}
if( r.getColumn() == 12 && r.getValue() == 'P') { //checks the column
var nextCell = r.offset(0, 1);
//if( nextCell.getValue() !== '' ) //is empty?
nextCell.setValue("P- N/A");
}
if( r.getColumn() == 15 && r.getValue() == 'P') { //checks the column
var nextCell = r.offset(0, 1);
//if( nextCell.getValue() !== '' ) //is empty?
nextCell.setValue("P- N/A");
}
if( r.getColumn() == 17 && r.getValue() == 'P') { //checks the column
var nextCell = r.offset(0, 1);
//if( nextCell.getValue() !== '' ) //is empty?
nextCell.setValue("P- N/A");
}
Etc.
What it does is it looks at a column and if there is a P then it offsets 1 column and pastes a P- N/A. Could someone help making the script shorter so it can run faster? Thank you.
You need to use getValues(range). This way you get an array. You can process this array and then use setValues(range) to fill all cells in the range at once with values of the array. It will work much faster.
Probably something like this:
function main() {
var s = SpreadsheetApp.getActiveSheet();
if (s.getName() != "Student Data-NEA") return;
var r = s.getActiveCell(); // current cell
var row = r.getRow(); // index of current row
var row_range = s.getRange("A"+row+":Z"+row); // get range of the row
var row_values = row_range.getValues().flat(); // get array [cell, cell, cell]
var value = "P- N/A";
// change the array (not the sheet)
if (row_values[9] == "P") row_values[10] = value;
if (row_values[11] == "P") row_values[12] = value;
if (row_values[14] == "P") row_values[15] = value;
if (row_values[16] == "P") row_values[17] = value;
// change the sheet
row_range.setValues([row_values]); // set all values for the row at once
}
If your conditions all the same, you can loop through list of columns this way:
var condition = "P";
var columns = [9, 11, 14, 16];
for (var col of columns) {
if (row_values[col] == condition) row_values[col+1] = value;
}
// instead of this
// if (row_values[9] == "P") row_values[10] = value;
// if (row_values[11] == "P") row_values[12] = value;
// if (row_values[14] == "P") row_values[15] = value;
// if (row_values[16] == "P") row_values[17] = value;
Update
I don't know why I do it, since the author of the question still provided almost no information about what he does with the table and we have no sample of the table, etc. But whatever:
If you need to change next cell to "P- N/A" (do you need it? I still have no idea) in some columns if edited cell contains "P", here is a script:
function onEdit(e) {
var s = e.source.getActiveSheet();
if (s.getName() != "Student Data-NEA") return;
var col = e.range.columnStart;
var row = e.range.rowStart;
var range = s.getRange(row,col,1,2);
var range_array = range.getValues();
var cell_value = range_array[0][0];
var next_cell_value = "P- N/A";
var cols = [10, 12, 15, 17];
if (cell_value == "P" && cols.includes(col)) {
range_array[0][1] = next_cell_value;
range.setValues(range_array);
}
}
But actually it can be done much easier and faster with standard Excel-like function (example for the cell "K1"):
=IF(EQ(J1,"P"),"P- N/A","")
Just populate with this function the columns K, M, P, R...

ng-pattern for mobile number validation

I am trying to implement mobile number validation on a Visualforce page using Angular JS, but am having problems getting my head around how to write the regex expression.
The requirements, as given to me, are fairly simple:
The number should be 10 digits long (I've already set the maxlength attribute on the field so this one is kind of taken care of already)
It should start with 04 (as it is an Australian mobile)
Only numbers should be allowed.
The regex expression I am using (in the ng-pattern attribute for my phone number input field) is:
^/(04)[0-9]{10}/$
This works up to a point - it does not allow anything other than numbers and does let me enter a 10 digit number starting with 04. However it also lets me enter numbers starting with, for example, 02, 03 etc....
Probably quite a simple thing I'm missing but I've had a look at quite a few sites, including this one, and can't find the answer.
Any help would be hugely appreciated as this one has caused me a few grey hairs already.
Try using this pattern
Use this in ur HTML file:
<input type="text" (keypress)="keyPress($event)" minlength=10 maxlength=10>
Use this in ur JS file:
keyPress(event: any) {
const pattern = /[0-9\+\-\ ]/;
let inputChar = String.fromCharCode(event.charCode);
if (event.keyCode != 8 && !pattern.test(inputChar)) {
event.preventDefault();
}
}
Try this one:
Mobile Number :
//inside view:
<input type="text" class="form-control" ng-model="mobileNo" name="mobileNo" ng-pattern="regEx" />
//inside controller:
$scope.regEx="/^[0-9]{10,10}$/";
For starters I had to create a whole js function for it... and it does validates as you type. here is my full code I hope this can help you get where you need.
This function gets the string every time a key is beign pressed and it allows the carrete to move front, back, delete and backspace. check it out and let me know if it helps you. you can run it on any situation and this is how I would add the "04" validation
//phone validation 10 digits and parenthesis (344)567-0011
function validatePhone(inputId) {
let validKey = false;
const input = document.getElementById(inputId);
let enteredDigits = input.value;
//switch to remove the country code added by default on autoComplete forms.
if (enteredDigits.length > 10 && enteredDigits[0] == '+') {
switch (enteredDigits.length) {
case 12:
enteredDigits = enteredDigits.slice(2);
break;
case 13:
enteredDigits = enteredDigits.slice(3);
break;
case 14:
enteredDigits = enteredDigits.slice(4);
break;
default:
enteredDigits = enteredDigits.replace(/\D+/g, '');
}
}
let newPhone = enteredDigits.replace(/\D+/g, ''); // This replace any character that is not a number.
const key = event.keyCode || event.charCode; // Get the pressed key.
let caretPosition = input.selectionStart; // get the carret position.
// splits, removes the "-" and converts from array to string and gives the needed digits.
const areaCode = newPhone.split('').splice(0, 3).toString().replace(/,/g, '');
const threeDigit = newPhone.split('').splice(3, 3).toString().replace(/,/g, '');
const fourDigit = newPhone.split('').splice(6, 8).toString().replace(/,/g, '');
// Moving carret on different positions. when the numeric keys are being pressed.
// Key >= 48 && key <= 58 number keys.
// Key >= 96 && key <= 105 numeric path number keys.
if ((key >= 48 && key <= 58) || (key >= 96 && key <= 105)) {
validKey = true;
if (threeDigit.length > 0) {
if (caretPosition == 1) {
caretPosition = caretPosition + 1;
} else if (caretPosition == 4 && newPhone.length == 4) {
caretPosition = caretPosition + 2;
} else if (caretPosition == 4 && newPhone.length >= 5) {
caretPosition = caretPosition + 1;
} else if (caretPosition == 5) {
caretPosition = caretPosition + 1;
} else if (caretPosition >= 2 && caretPosition <= 3 && newPhone.length <= 4) {
caretPosition = caretPosition + 1;
}
}
if (fourDigit.length > 0 && caretPosition == 9) {
caretPosition = caretPosition + 1;
}
}
// Key = 8 = Backspace.
else if (key == 8) {
validKey = true;
if (caretPosition == 3 && newPhone.length == 3) {
caretPosition = caretPosition - 1;
} else if (caretPosition == 2 && newPhone.length == 3) {
caretPosition = caretPosition - 1;
} else if (caretPosition == 1 && newPhone.length == 3 && threeDigit.length == 0) {
caretPosition = caretPosition - 1;
}
}
// Key = 46 = Delete. Key =37 = ArrowLeft. Key = 39 = ArrowRight.
else if (key == 46 || key == 39 || key == 37) {
validKey = true;
// Delete
if (key == 46) {
if (caretPosition == 0 && newPhone.length > 3) {
caretPosition = caretPosition + 1;
} else if (caretPosition == 1 && newPhone.length == 3) {
caretPosition = caretPosition - 1;
} else if (caretPosition == 2 && newPhone.length == 3) {
caretPosition = caretPosition - 1;
} else if (caretPosition == 3 && newPhone.length == 3) {
caretPosition = caretPosition - 1;
} else if ((newPhone.length >= 4 && caretPosition == 4) || (newPhone.length >= 4 && caretPosition == 8)) {
caretPosition = caretPosition + 1;
}
}
}
//here is the validation for the country that you need.
if ((newPhone.length == 1 && newPhone[0] != '0') || (newPhone.length >= 2 && newPhone[1] != '4')) {
alert('Must start with 04');
newPhone = '';
}
// Adding the special character for formatting.
if (threeDigit.length > 0 && fourDigit.length == 0) {
newPhone = '(' + areaCode + ')' + threeDigit;
} else if (fourDigit.length > 0 && threeDigit.length == 3) {
newPhone = '(' + areaCode + ')' + threeDigit + '-' + fourDigit;
}
if (!validKey) {
caretPosition = caretPosition - 1;
}
// Set new values.
newPhone = newPhone.substring(0, 13);
input.value = newPhone;
input.focus();
input.setSelectionRange(caretPosition, caretPosition);
}
<form name="myForm"
onsubmit="return validateForm()"
method="post">
Phone number: <input type="text"
id="phoneNumber"
name="fPhone"
onkeyup="validatePhone('phoneNumber')">
<input type="submit"
value="Submit">
</form>

Actionscript 3 - How to Check if an Array Position Already Exists

Hello my question is as stated. I have a randomly generated dungeon with a player and random blocks. All the rooms in the dungeon are saved in the ROOMS 2D array which contains the data for the rooms. You have a current Row and current Col which is where the player is at. What i need to know is how to say IF there is no room above the current position then change the outside wall graphic to close the exits/doors where there is no room. I have this somewhat working but everyway i change it there is always one room which just will not work if i try to add the code. What i have now is abunch of if statements saying IF ROOMS[currentRow + 1][currentCol](< that would be equal to down) so if one row up exists then change the graphic by doing gotoAndStop. So how or which is the best way to determine if a position exists because with this, it will randomly comeback with errors like "term is undefined and has no properties." Also i have really dirty code, sorry im new, ill try to clean it up later but if any of you feel like it, i wont stop you haha!
Im grateful for any replies! Here is my room class
package {
import flash.display.MovieClip;
import flash.events.Event;
public class Room extends MovieClip{
var room1:Array = new Array();
var room2:Array = new Array();
var room3:Array = new Array();
var room4:Array = new Array();
var room5:Array = new Array();
var room6:Array = new Array();
var room7:Array = new Array();
var room8:Array = new Array();
var room9:Array = new Array();
var room10:Array = new Array();
var currentRow:int = 0;
var currentCol:int = 0;
var box:Box;
var boxes:Array;
var ROOMS:Array;
var onTop:Boolean;
var moved:Boolean;
private var player:Player;
private var walls:Walls;
private var blocker1:Blocker;
private var blocker2:Blocker;
private var blocker3:Blocker;
private var blocker4:Blocker;
private var arrowImage:ArrowSymbol;
public function Room(){
init();
createRooms();//add the walls + boxes of first room to the first array value // later make floors array that contains all the rooms and room array that contains all the boxes and enemies + events
stage.addChild(ROOMS[currentRow][currentCol]);
Constants.wallsRef = ROOMS[currentRow][currentCol];
addEventListener(Event.ENTER_FRAME, update);
stage.addChild(arrowCount);
stage.addChild(arrowImage);
}
function init(){
Constants.stageRef=stage;
player = new Player();
//add walls
walls = new Walls();
Constants.wallsRef=walls;
blocker1 = new Blocker();//BLOCKER WHEN PLAYER TOUCHES IT CHANGES ROOM
blocker1.x = 350;
blocker1.y = 1;
stage.addChild(blocker1);
blocker2 = new Blocker();
blocker2.x = 350;
blocker2.y = 619;
stage.addChild(blocker2);
blocker3 = new Blocker();
blocker3.x = -30;
blocker3.y = 300;
blocker3.rotation = 90;
stage.addChild(blocker3);
blocker4 = new Blocker();
blocker4.x = 700;
blocker4.y = 300;
blocker4.rotation = 90;
stage.addChild(blocker4);
Constants.blockerRef1 = blocker1;
Constants.blockerRef2 = blocker2;
Constants.blockerRef3 = blocker3;
Constants.blockerRef4 = blocker4;
//add player
player.x = 300;
player.y = 200;
stage.addChild(player);
arrowImage = new ArrowSymbol();
arrowImage.x = 630;
arrowImage.y = 30;
box = new Box();
boxes = new Array();
ROOMS = new Array([room2],
[room6, room1, room5], /// THIS IS THE MAP OF THE FLOOR /// GOING UP ON THE GAME IS GOING DOWN ON IT
[room7, room8],
[room3, room9],
[room4]);//THIS WILL EVENTUALLY BE COMPLETELY RANDOMIZED//
onTop = false;
moved = false;
}
function update(e:Event){
arrowCount.text = " " + Constants.arrowNumRef;//arrow amount left
closeUnnecessaryExits();
//UP
if(Constants.blockerRef1.hitTestPoint(player.x,player.y) && moved != true){
stage.removeChild(ROOMS[currentRow][currentCol]);//remove the room you are in so the new room doesnt overlap
currentRow++;//change where the player is in
stage.addChild(ROOMS[currentRow][currentCol]);//add new room
Constants.wallsRef = ROOMS[currentRow][currentCol];//add colision
player.y = 600;
stage.addChild(arrowCount);
stage.addChild(arrowImage);
trace();
moved = true;
}else if(Constants.playerRef.hitTestObject(Constants.blockerRef1) == false && moved == true){
moved = false;
}
//DOWN
if(Constants.blockerRef2.hitTestPoint(player.x,player.y) && moved != true){
//this will be where i want to change rooms
stage.removeChild(ROOMS[currentRow][currentCol]);
currentRow--;
Constants.wallsRef = ROOMS[currentRow][currentCol];
stage.addChild(ROOMS[currentRow][currentCol]);
player.y = 10;//change to 600
moved = true;
trace("changed rooms");
stage.addChild(arrowCount);
stage.addChild(arrowImage);
}else if(Constants.playerRef.hitTestObject(Constants.blockerRef1) == false && moved == true){
moved = false;
}
//LEFT
if(Constants.blockerRef3.hitTestPoint(player.x,player.y) && moved != true){
stage.removeChild(ROOMS[currentRow][currentCol]);//remove the room you are in so the new room doesnt overlap
currentCol--;//change where the player is in
stage.addChild(ROOMS[currentRow][currentCol]);//add new room
Constants.wallsRef = ROOMS[currentRow][currentCol];//add colision
player.x = 600;
stage.addChild(arrowCount);
stage.addChild(arrowImage);
moved = true;
}else if(Constants.playerRef.hitTestObject(Constants.blockerRef1) == false && moved == true){
moved = false;
}
//RIGHT
if(Constants.blockerRef4.hitTestPoint(player.x,player.y) && moved != true){
//this will be where i want to change rooms
stage.removeChild(ROOMS[currentRow][currentCol]);
currentCol++;
Constants.wallsRef = ROOMS[currentRow][currentCol];
stage.addChild(ROOMS[currentRow][currentCol]);
player.x = 10;//change to 600
moved = true;
trace("changed rooms");
stage.addChild(arrowCount);
stage.addChild(arrowImage);
}else if(Constants.playerRef.hitTestObject(Constants.blockerRef1) == false && moved == true){
moved = false;
}
}
function createRooms(){
for(var r = 0; r <ROOMS.length; r++){
walls = new Walls();
addRandomBlocks();
for(var c = 0; c < ROOMS[r].length; c++){
walls = new Walls();
addRandomBlocks();
ROOMS[r][c] = walls;
}
trace(ROOMS[r][c]);
}
}
// [room2, NaN],
// [room6, room1, room5], /// THIS IS THE MAP OF THE FLOOR /// GOING UP ON THE GAME IS GOING DOWN ON IT
// [room7, room8],
// [room3, room9],
// [room4]);
function closeUnnecessaryExits(){
trace("ROW: " + currentRow + " COL: " + currentCol);
var up = ROOMS[currentRow + 1];
var down = ROOMS[currentRow - 1];
var right = ROOMS[currentRow][currentCol + 1];
var left = ROOMS[currentRow][currentCol - 1];
//check to see which outside wasall to use
if(ROOMS[currentRow + 1] == null && up && right && left){
ROOMS[currentRow][currentCol].gotoAndStop(2);
}else if(down == null && left == null && right && up){
ROOMS[currentRow][currentCol].gotoAndStop(3);
}else if(down == null && left == null && up == null && right){
ROOMS[currentRow][currentCol].gotoAndStop(4);
}else if(left == null && down && right && up){// IF HAVING PROBLEMS THEN MAKE THIS MAKE SURE ALL OTHER SIDES ARE TRUE
ROOMS[currentRow][currentCol].gotoAndStop(5);
}else if(down == null && left == null && right == null && up){
ROOMS[currentRow][currentCol].gotoAndStop(6);
}else if(down && up == null && right == null && left == null){
ROOMS[currentRow][currentCol].gotoAndStop(7);
}else if(ROOMS[currentRow + 1][currentCol] == null && ROOMS[currentRow - 1][currentCol] && left && right){
ROOMS[currentRow][currentCol].gotoAndStop(8);
trace("works 1");
}else if(left && right && ROOMS[currentRow - 1][currentCol] == null && ROOMS[currentRow + 1][currentCol] == null){
ROOMS[currentRow][currentCol].gotoAndStop(9);
trace("works 2");
}else if(left && ROOMS[currentRow - 1][currentCol] && right == null && ROOMS[currentRow + 1][currentCol] == null){
ROOMS[currentRow][currentCol].gotoAndStop(10);// LEFT DOWN
trace("works 3");
}else if(left && ROOMS[currentRow + 1][currentCol] && ROOMS[currentRow - 1][currentCol] == null && right == null){
ROOMS[currentRow][currentCol].gotoAndStop(11);//BROKEN left up
trace("working 4");
}else if(left && ROOMS[currentRow + 1][currentCol] == null && ROOMS[currentRow - 1][currentCol] == null && right == null){
ROOMS[currentRow][currentCol].gotoAndStop(12);
trace("works 5");
}else if(right == null && left && up && down){
ROOMS[currentRow][currentCol].gotoAndStop(13);
trace("works 6");
}
}
function addRandomBlocks(){
for(var e=0; e <Math.random() * 10; e++){
//trace("started block");
box = new Box();
box.x = Math.random() * (615 - 100) + 100;
box.y = Math.random() * (500 - 120) + 120;
//colision for block to block
for(var col = 0; col < boxes.length; col++){
if(box.hitTestObject(boxes[col])){
onTop = false;/// THIS NEEDS TO BE TRUE FOR THE DETECTION TO WORK
//trace("THIS BOX IS ON TOP OF ANOTHER");
}
}
if(onTop == false){
boxes.push(box);
walls.addChild(box);
trace("BOX CREATED " + onTop);
//trace(boxes);
}
}
}
}
}
You could streamline your code by creating some simple functions that deal with assigning and accessing values in your 2D array. One that checks if an element within a 2D array exists might look like:
function cellExists(array:Array, x:int, y:int):Boolean {
return array[y] !== undefined && array[y][x] !== undefined;
}
Used like, in your example:
if (cellExists(ROOMS, currentCol, currentRow)) {
//
}
Although with this type of task you would benefit greatly from implementing a class that handles grid + cell data, something along the lines of this to get you started:
public class Grid {
private var _content:Vector.<Vector.<Cell>>;
public function Grid(columns:int, rows:int) {
// Fill _content with empty slots based on columns, rows.
}
public function getCell(x:int, y:int):Cell {}
public function cellExists(x:int, y:int):Boolean {}
}

Update value from inputText

I'm working with ADF BC and I have several inputTexts.
Let's say I have the folowing scenario:
Step 1: inserting 1, 2, 3 in three different inputTexts (it1, it2 and it3, all three with autoSubmit == true).
Step 2: Click a button who calls the following method:
public String aplicarFiltro() {
Object it1param = null, it2param = null, it3param = null, sos1param = null;
Parametros_IndicadoresLoadAll pila = Parametros_IndicadoresLoadAll.getInstance();
pila.clear();
if(it1.getValue() == null || it1.getValue().toString().isEmpty()) {
it1param = "";
} else {
it1param = it1.getValue();
if(it2.getValue() == null || it2.getValue().toString().isEmpty()) {
it2param = "";
} else {
it2param = it2.getValue();
if(it3.getValue() == null || it3.getValue().toString().isEmpty()) {
it3param = "";
} else {
it3param = it3.getValue();
}
}
}
if(sos1.getValue() != null) {
sos1param = sos1.getValue();
}
pila.init(it1param, it2param, it3param, sos1param);
if (it1.getValue() == null || it1.getValue().toString().isEmpty()) {
showPopup(p1, true);
/* } else if (sos3.getValue() == null) {
showPopup(p2, true); */
}
return null;
}
Step 3: I erase the values from it2 and it3, I click the button again and call the same method. However, the value from it2 and it3 stays the same.
Why does this happen and how can I fix it?
Try to re-think your approach: instead of doing the business in backing beans, try to use BC layer. So you can move the method
public String aplicarFiltro() {..} into Application Module Impl.
There, programatically get a reference to your VO's current Row and read the attribute's values.
First, test your scenario (your method) from BC Tester. Then, you can expose the method through bindings, and call it from backing beans.
ALso, I would expose the RowImpl class for your VO and put some debug info into setIt1(), setIt2(), setIt3() attributes, to see how the change.
Remember, is always far more simple to manage your business on BC layer than managed beans. Stay away from JSF life cycle.
Don't know if more things are wrong. But you're only setting "i2param" to something other than null if i1 has a value and "i3param" to something other then null if i1 and i2 has a value.
So start with the following. Change this:
if(it1.getValue() == null || it1.getValue().toString().isEmpty()) {
it1param = "";
} else {
it1param = it1.getValue();
if(it2.getValue() == null || it2.getValue().toString().isEmpty()) {
it2param = "";
} else {
it2param = it2.getValue();
if(it3.getValue() == null || it3.getValue().toString().isEmpty()) {
it3param = "";
} else {
it3param = it3.getValue();
}
}
}
to:
if(it1.getValue() == null || it1.getValue().toString().isEmpty()) {
it1param = "";
} else {
it1param = it1.getValue();
}
if(it2.getValue() == null || it2.getValue().toString().isEmpty()) {
it2param = "";
} else {
it2param = it2.getValue();
}
if(it3.getValue() == null || it3.getValue().toString().isEmpty()) {
it3param = "";
} else {
it3param = it3.getValue();
}

AS3: A term is undefined

All right so the first piece of code here is for when the user is re-selecting a button for it to clear and then set the Array spot to a blank number. The second piece is where the issue is with the error A term is undefined. Now i haven't had this issue until I added the first piece.
if(tempArray[1] == pickFive[0]){
Game.BARR.balls.balls2.b1.num1.text = '';
pickFive.splice(pickFive.indexOf(tempArray[1]), 1);
pickFive[0] = ("");
}
if(pickFive[0] != null){
//trace(Game.NumberBoard_mc.Pick5['btn_' + pickFive[0]].name);
Game.NumberBoard_mc.Pick5['btn_' + pickFive[0]].gotoAndStop(2);//Saying this line
Game.BARR.balls.balls2.b1.num1.text = pickFive[0];
}
if (pickFive.indexOf(tempArray[1]) != -1) {
if(event.target.currentFrame == 2) {
event.target.gotoAndStop(1);
}
if(tempArray[1] == pickFive[0]){
Game.BARR.balls.balls2.b1.num1.text = '';
pickFive[0] = "";
}
if(pickFive[0] != null){
    if(pickFive[0] != ""){
    Game.NumberBoard_mc.Pick5['btn_' + pickFive[0]].gotoAndStop(2);
    Game.BARR.balls.balls2.b1.num1.text = pickFive[0];
    }
  }

Resources