mardi 9 mai 2023

i wanna change the icon in the checkbox.item in the react native .....i've used formik, yup for this form validation

I want to change the icon view because it's producing unsatisfactory results for form validation. I am new to React Native and I'm having trouble fixing the checkbox. React Native Elements blocked the checkbox and I need the link for the React Native Community checkbox where I can find examples of class-based components. I've tried implementing the suggested styling, but I'm still having a lot of confusion. Can you please assist me?




dimanche 7 mai 2023

Powerapps: Clear/Reset Gallery fields with button

I have a simple question that I haven't found or understood anywhere on the internet. I'm a novice powerapps user. I would like to click a button and clear all fields (inputText, checkbox, etc) from a gallery. Details: My data source is some excel tables; this gallery (not a collection or a form for god's sake) has some information from my data source (tab_lista). I tried the following command without success:

Mybutton

OnSelect

ForAll(BrowseGallery1.AllItems;
    If(ThisRecord.Checkbox1.Value = true;Checkbox1.Value = false);;
    ThisRecord.InputText1.Text = ""
)

Segue uma imagem.

enter image description here




samedi 6 mai 2023

Userfrom Checkbox concatenate to cell with separators

I have created userform to enter data to excel sheet. The userform contains textbox, combobox and checkbox. I have separated the checkbox with two different group but not in frame. 2 groups with 5 checkbox each group. Group name i have given in checkbox properties. The value of the checkbox is written is Caption properties.

I have given this code to enter data i desired.

Dim selectedOptions1 As String
Dim selectedOptions2 As String
  If ColSamp.Value = True Then
    selectedOptions1 = ColSamp.Caption
     End If
     If Dummy.Value = True Then
        If selectedOptions1 <> "" Then
        selectedOptions1 = selectedOptions1 & " & "
    End If
    selectedOptions1 = selectedOptions1 & Dummy.Caption
End If
If gmg.Value = True Then
    If selectedOptions1 <> "" Then
        selectedOptions1 = selectedOptions1 & " & "
    End If
    selectedOptions1 = selectedOptions1 & gmg.Caption
End If
If LsrPrf.Value = True Then
    If selectedOptions1 <> "" Then
        selectedOptions1 = selectedOptions1 & " & "
    End If
    selectedOptions1 = selectedOptions1 & LsrPrf.Caption
If SizSamp.Value = True Then
    If selectedOptions1 <> "" Then
        selectedOptions1 = selectedOptions1 & " & "
    End If
    selectedOptions1 = selectedOptions1 & SizSamp.Caption
End If
End If
If Emboss.Value = True Then
    selectedOptions2 = Emboss.Caption
     End If
If Deboss.Value = True Then
    If selectedOptions2 <> "" Then
        selectedOptions2 = selectedOptions2 & " & "
    End If
    selectedOptions2 = selectedOptions2 & Deboss.Caption
End If
If DieCuting.Value = True Then
    If selectedOptions2 <> "" Then
        selectedOptions2 = selectedOptions2 & " & "
    End If
    selectedOptions2 = selectedOptions2 & DieCuting.Caption
End If
If WindPast.Value = True Then
    If selectedOptions2 <> "" Then
        selectedOptions2 = selectedOptions2 & " & "
    End If
    selectedOptions2 = selectedOptions2 & WindPast.Caption
If FoldPaste.Value = True Then
    If selectedOptions2 <> "" Then
        selectedOptions2 = selectedOptions2 & " & "
    End If
    selectedOptions2 = selectedOptions2 & FoldPaste.Caption
End If
End If

it is working if i checked all the check box if i'm checked one box between the value is not combining after that. What i'm doing wrong in this.




vendredi 5 mai 2023

How to save the State of multiple checkbox with SharedPreferences in Flutter?

I'm learning flutter and right now working on a To Do List project with local storage using sqflite. I implemented a checkbox in the activities from the card (TestListItem) that I used to build my SliverList and want to save it state for when the user close and reopen the app. I tried to use the SharedPreferences:

class _TestListItemState extends State<TestListItem> {
  bool _checkbox = false;
  final TextEditingController updatedTaskController = 
  TextEditingController();
  final TextEditingController updatedDateController = 
  TextEditingController();

  @override
  void initState() {
  _loadCheckedValue();
  }

  _savedCheckedValue() async {
    SharedPreferences prefs = await 
    SharedPreferences.getInstance();
    setState(() {
      prefs.setBool("check", _checkbox);
    });
  }

  _loadCheckedValue() async {
    SharedPreferences prefs = await 
    SharedPreferences.getInstance();
    bool? isChecked = prefs.getBool("check");
    setState(() {
      _checkbox = isChecked ?? false;
    });
  }

Here's the checkbox:

child: CheckboxListTile(
    controlAffinity: ListTileControlAffinity.leading,
    secondary: IntrinsicWidth(
      child: Row(...),
    )
    title: Text(...),
    ),
    subtitle: Text(...),
    ),
    activeColor: fabColor,
    value: _checkbox,
    onChanged: (bool? value) async {
      setState(() {
        _checkbox = !_checkbox;
        _savedCheckedValue();
      });
    }),

Here's the Provider:

class TaskProvider extends ChangeNotifier {
  List<TaskModel> tasks = [];
  List<bool> checked = [];

  Future insertInDatabase(String activity, String date) async {
    final newTask =
      TaskModel(taskId: const Uuid().v1(), activity: activity, 
      date: date);
    tasks.add(newTask);
    await TaskDao().save(TaskModel(
        taskId: newTask.taskId,
        activity: newTask.activity,
        date: newTask.date));
    notifyListeners();
  }

  Future<List<TaskModel>> readFromDatabase() async {
    final taskList = await TaskDao().findAll();
    tasks = taskList;
    return tasks;
  }

  Future updateFromDatabase(
    String taskId,
    String activity,
    String date,
  ) async {
    final updatedTask =
    TaskModel(taskId: taskId, activity: activity, date: date);
    await TaskDao().update(updatedTask);
    notifyListeners();
  }

  Future deleteFromDatabase(String taskId) async {
    await TaskDao().delete(taskId);
    notifyListeners();
  }
}

And here's my SliverList:

child: Consumer<TaskProvider>(
      builder: (BuildContext context, TaskProvider provider, 
      Widget? child)
        {return FutureBuilder<List<TaskModel>>(
          future: provider.readFromDatabase(),
          builder: (context, snapshot) {
            var items = snapshot.data;
            switch (snapshot.connectionState) {
              case ConnectionState.none:
                {
                  return const Loading();
                }
              case ConnectionState.waiting:
                {
                  return const Loading();
                }
              case ConnectionState.active:
                {
                  return const Loading();
                }
              case ConnectionState.done:
                {
                  if (snapshot.hasData && items != null) {
                    if (items.isNotEmpty) {
                      return CustomScrollView(
                        slivers: <Widget>[
                          SliverToBoxAdapter(
                            child: Text(...),
                          ),
                          SliverPadding(...),
                            sliver: SliverList(
                              delegate: SliverChildBuilderDelegate(
                                    (context, index) {
                                  return TestListItem(
                                    task: items[index], index: 
                                    index,);
                                },
                                childCount: items.length,
                              ),
                            ),
                          ),
                        ],
                      );
                    }
                  }

With this I'm saving the state, but it applys the same value to all checkboxes (when I check one close and reopen the app they are all checked, same with the opposite).

I'm not getting what can I do to save them individually. Do I have to save a list of bool (representing the checked values) in provider, or create a column in the sqflite database (again representing the checked values)?

It should be simple with the SharedPreferences right? How can I solve this...




jQuery Pull Label for HTML Checkbox into Comma-Separated String

I have an .aspx with multiple HTML checkboxes. I am trying to pull the value of all checked checkboxes into a comma-separated string. I can get the ID of the checkbox, but what I really want is the label text.

.aspx:

<div id="divIssueTypes">
    <label for="CDAccess">Access</label>
    <%: Html.CheckBox("CDAccess") %>
    
    <label for="CDReporting">Reporting</label>
    <%: Html.CheckBox("CDReporting") %>
    
    <label for="CDSeparatelyLocked">Separately locked (subject to abuse)</label>
    <%: Html.CheckBox("CDSeparatelyLocked") %>
    
    <label for="CDEmergencyAccess">Emergency access</label>
    <%: Html.CheckBox("CDEmergencyAccess") %>
    
    <label for="CDCounts">Counts</label>
    <%: Html.CheckBox("CDCounts") %>
    
    <label for="CDDisposition">Disposition</label>
    <%: Html.CheckBox("CDDisposition") %>
    
    <label for="CDDiversion">Diversion</label>
    <%= Html.CheckBox("CDDiversion") %>
</div>

jQuery:

var checkedVals = ($("#divIssueTypes").find('input:checkbox:checked').map( function() {
        return this.id;
    }).get().join(","));

If, for example, all checkboxes were checked my code would return: CDAccess,CDReporting,CDSeparatelyLocked,CDEmergencyAccess,CDCounts,CDDisposition,CDDiversion

But I would like it to return:
Access,Reporting,Separately locked (subject to abuse),Emergency access,Counts,Disposition,Diversion

Is this at all possible?




jeudi 4 mai 2023

How to read Apex 21.2 CheckboxGroup values in PL/SQL

I'm using Apex 21.2 on a 21.C database. I can't read the values that the user has checked when I execute a PL/SQL dynamic action.
The Checkbox Group field is called P302_MINISTRY_GROUP.
The Type = Checkbox Group. The LOV SQL Query = Select ministry || ' - ' || role display, prim_key return from vol_ministry order by ministry, role; I did not put anything into the Source, Default, or Server Side Conditions. I created a dynamic action that fires when the user presses the "Save" button.
For the TRUE Action = Execute Server-side Code. The PL/SQL code is:

declare
  l_dummy number;
  l_volunteer_pk number;
begin
  l_volunteer_pk := :P302_PRIM_KEY;
  for cur_r in (select * From table(apex_string.split(:P302_MINISTRY_GROUP, ':'))) 
  loop
    select prim_key
      into l_dummy
      from vol_contact_ministry where ministry_fkey = cur_r.column_value
                                  and contact_fkey = l_volunteer_pk;
    if l_dummy is null then
       -- checked value does not exist
       insert into vol_contact_ministry (ministry_fkey, contact_fkey, status) 
                                 values (cur_r.column_value, l_volunteer_pk, 'Active');
    --else
       -- checked value exists
    --   delete from vol_contact_ministry where ministry_fkey = cur_r.column_value
    --                                      and contact_fkey = l_volunteer_pk;
    end if;
  end loop;
end;

The checkboxes display on the screen with the concatenated fields just fine. When the user checks one or more boxes and presses "Save", I would expect that the PL/SQL would loop through the checked boxes and give the prim_key associated with that box. But I can't seem to get any values at all. As a test I tried inserting the entire field :P302_MINISTRY_GROUP but the table shows Null for that insert. The PL/SQL is firing properly when the button is pressed based on other tests that I made, but I can't get this code above to work. How do I obtain the values of checked boxes from a Checkbox Group so that I can manipulate it in PL/SQL ?




Handling Forms with JavaScript - Checkbox Validation

I'm currently studying JavaScript and still in beginner level. So, I referred given code from a certain Open Learning Platform. Its intention was to validate whether the checkbox is checked or not (that's how it was said in there). but it won't output any message. Could you help me with it.

<body>
    <script type="text/javascript">
        const form = document.getElementById('form')
        const checkBox = document.getElementById('checkbox')
        const message =document.getElementById('message')
        
        form.addEventListener('submit', function checkBoxValidator(x) {
            x.preventDefault()
            if (checkBox.checked === true) {
                message.innerHTML = 'Done'
            }
            else {
                message.innerHTML = 'Please Check Something'
            }
        })
    </script>

    <form id="form">
        <input type="checkbox" id="checkbox"> Checkbox
        <button type="submit">Submit</button>
        <h3 id="message"></h3>
    </form>
</body>

Thank You!

I tried refer some external resources as such and as far as my knowledge I cannot find where the error stands.