How to make a list details button wider for one click updates

Hi there @Jjenglert @keymaker @artur @Maria @Workflowheroes_Marc

When I click on below ‘Submit’ button (Conditional Form) I want this to update the status of the Record within my parent table ‘Enquiries’ (list details block) with its associated child table records (Enquiry line items).

Currently when I click the Submit button I pass the hidden Update Status but it does this for a new record within the Enquiries table instead of the record within the list details block of the page. How do I change the status of this record?

Thank you

Hey George.

Softr forms blocks are 99% of the situations, meant to create new records.

If you need to update a parent from another table after submitting the form, you will have to work the logic in the backend datasource.

Thanks for input Jonathan.

All i need is a one click update button that stretches out wide.
Hence, the form is purely used for UX as my ‘Submit’ button because the other buttons are too small.

Do you have any ways round this? I can use Make but prefer to have within Softr/Airtable if possible.

Thanks

It really depends on the UX you’re aiming for, but if your main goal is to have a larger button for triggering the form submission (and you’re not happy with the existing small action buttons), I’d suggest this approach:

You can create a custom HTML button that visually stretches out the way you want. Then, using JavaScript, you can “mask” the action of clicking that button to trigger the click event of the hidden smaller button (the one tied to your record update or form submission action). This way, the larger button will feel like it’s performing the update, but it’s actually triggering the same action as the small button.

Here’s a basic example:


<button id="customUpdateButton" style="width: 100%; padding: 20px; background-color: #007BFF; color: white; border: none;">
  Update Record
</button>

<script>
  document.getElementById("customUpdateButton").addEventListener("click", function() {
    // Trigger the click of the hidden button (the one tied to your action)
    document.querySelector(".your-action-button-class").click();
  });
</script>

In this example, when you click the large #customUpdateButton, it will programmatically trigger the click event of the smaller action button (with class your-action-button-class). You can customize the styles and layout of the button to match your UX needs.

This way, you don’t need to alter the action button itself, and you still get a larger clickable area

Bear in mind this is just one possible way, it may not fit 100% to your need but it could eventually open the door to more possibilities for customization.

1 Like

I don’t think there’s a native way to accomplish this in a one-click solution. If you want to do this within Softr/Airtable, I’d recommend setting the button to be part of a list details block and have it trigger a popup to edit the record, with only the field you want to change visible.

I’m not a traditional coder, but you should be able to use custom code to send a POST request to an Airtable webhook, which would allow you to do this with one-click.

A simple CSS code should do the trick for your UX issue,

Just create a list-details block with the correct data source and conditional filters. Then remove everything except the button. Then tell me the Id of this list-details block and I will give you the code.

The width expansion of the block can also be done within your existing list-details block if you prefer.

All of this is true for new list-details block. Though this can be done natively with an old list-details block

Here is the result with css code for a new list-details block
What you see is not a button of a form but the button of a list-details block




Here is how to stretch a button of an old list-details block (justify option)

1 Like

Hey Matthieu
Thanks for this.

I have created a second list-details block [mapped to same table as the first list-details block] with just the ‘One Click Update’ button visible.

ID is: list-details2

Thanks!

Just copy-paste the code below in the page settings => custom code => code inside header:

<style>
#list-details2 [data-softr-action-type="UPDATE_RECORD"] {
    margin: 0 auto !important;
    min-width: 600px !important;
}

@media (max-width: 768px) {
    #list-details2 [data-softr-action-type="UPDATE_RECORD"] {
        min-width: 250px !important;
    }
}
</style>

Explanation:
The first part of the code is for any device. I set the width of the button to 600px (feel free to adjust it) and give it a center alignment.

The second part of the code ( @media (max-width: 768px ) narrows the conditions set for in the first part to adapt it to mobile devices. I set the width of the button to 250px on mobile (feel free to adjust it). This way it can be responsive.

Tell me if it works, otherwise I will debug/improve it.

2 Likes

Awesome mate, that worked :call_me_hand:

2 Likes

Sorry to dig this up now that you have a working solution, but for context, why not use the “one-click update” action button on the list details block?

Reason I wasn’t using that before was because of the button being small.

Now with Matthieus code it has made the one click update button longer

Hi @matthieu_chateau

When I click the button, it also makes the below two buttons extended so they become out of format (as per below).

Any suggestions?

Thanks
George

Hi Georges,

Yes, the working code is :

<style>
#list-details2 [data-softr-action-type="UPDATE_RECORD"] {
    margin: 0 auto !important;
    min-width: 600px !important;
}

@media (max-width: 768px) {
    #list-details2 [data-softr-action-type="UPDATE_RECORD"] {
        min-width: 250px !important;
    }
}
</style>

I updated my post above. The problem is that the selector was not precise enough + not stable.
data-softr-action-type is a new stable selector that we can use without any problem now.

Hey again
I couldnt get this latest code to work.
One of my buttons is a one click update and one is an edit record.
Is it possible to have both codes in custom code header or it wont work?
Thanks

In this case:

<style>
#list-details1 [data-softr-action-type="UPDATE_RECORD"],
#list-details1 [data-softr-action-type="UPDATE_FIELDS"] {
    margin: 0 auto !important;
    min-width: 600px !important;
}

@media (max-width: 768px) {
    #list-details1 [data-softr-action-type="UPDATE_RECORD"],
    #list-details1 [data-softr-action-type="UPDATE_FIELDS"] {
        min-width: 250px !important;
    }
}
</style>

Change #list-details1 by your block ID(s)
[data-softr-action-type="UPDATE_FIELDS"] is the stable selector for one click update action buttons.
Also this code is true if you use a new item details block (not the old ones).