Tap Forms app icon half
Tap Forms Forum text image
Blue gradient background

Exchange tips and ideas with the Tap Forms community

Search Results for 'script'

Viewing 15 results - 106 through 120 (of 2,990 total)
  • Author
    Search Results
  • #52675
    Brendan
    Keymaster

    I just fixed the favourite scripts bug.

    #52674
    Brendan
    Keymaster

    Ah right. Sorry about that. I didn’t realize you weren’t referring to the Mac version.

    Ya, I haven’t built the script sorting function into the iOS version. Certainly something I should add.

    I’ll look into the favourites issue.

    #52673
    Fernando Duran
    Participant

    Hello Brendan, thank you for your quick response. I forgot to say that I use the iPhone, I don’t have a Mac. I have already tried to press and drag the scripts without success. And on the iPhone I have not been able to modify the font of the List mode, as I can do in Tap Forms 5.

    By the way, I’ve seen something else. I can’t run the scripts from the Favourites section, only from the Run a script section.

    #52672
    Brendan
    Keymaster

    Hi Fernando,

    You can just drag and drop your scripts to put them into the order that you want them to be in.

    I don’t have a function for changing the font in Tap Forms for Mac for the single column list view.

    Thanks,

    Brendan

    #52671
    Robin McClish
    Participant

    Thank you so much, Daniel! I’ll try that. Btw, I went looking but couldn’t find where to search for the answer. Can you tell me if there is a document that covers script differences between TF and TFP? Mmaybe I just missed it.
    Thanks again,
    Robin

    Fernando Duran
    Participant

    Hello everyone, I’ve been using Tap Forms for a few years and I recently downloaded the new Pro. In general, I’m liking it, although I’ve found some small problems. Specifically, I can’t organise my scripts numerically as I do in Tap Forms 5, nor can I change the font in List mode, although I can in the others. I would appreciate your help. Thank you very much and best regards.

    #52669
    Daniel Leu
    Participant

    Looks like you’re using Tap Forms Pro. So getForms() is now called fetchForms() and getFields() is now fetchFields(). At a quick glance, I haven’t spotted any other API changes affecting the script.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #52668
    Robin McClish
    Participant

    Good day, Sam (or anyone else who might be able to jump in),

    I was looking for a way to copy a record from one form to another and found Sam’s script. I am very much looking forward to getting it working.

    I changed getID to getId, so that part should be fine. However, I am now getting the following error, and I am unable to determine the new method for obtaining a list of available forms. If you have time, may I please trouble you to offer possible suggestions?

    7/11/25, 12:04:07 / Nails / Copy record to another Form
    Copy record to another Form: TypeError: document.getForms is not a function. (In ‘document.getForms()’, ‘document.getForms’ is undefined), line:(null)

    Thank you for any time and expertise you can spend answering my question.

    Respectfully,

    Robin McClish
    (a very, very new scripter)

    #52639

    In reply to: Using Subforms

    Daniel Leu
    Participant

    That has always been a challenge to show data that is coming from a linked form that is linked to another form. But thinking about this again, I found a solution :-)

    First, you have to enable ‘show reverse relationship’ on all linked fields.

    Then, in the house form, add a field script that returns the record id of the house record (house_id). Then in the tenant form, add another field script that returns the record id of the house record (house_id). To do this you have to traverse the linked fields back to the apartment and then to the house.

    Now in the house form, change the tenant linked field type to ‘joined’ and use the two house_id fields to link the two form.

    Now you can see all the tenants and can directly select them in the house form. When creating a new tenant or assigning one, you might have to click ‘refresh records’ to get the updated data!

    Please have a look at the attachment that shows this functionality at work.

    Another approach would be following:
    In the apartment form, add a field script that returns the name of the tenant:

    function tenant() {
    
        const mieter_id = 'fld-3bad25ed396f42e49da9780dd86d1920';
    
        const mieter__name_id = 'fld-a255f473fd744c398134add2a87a3cc9';
        const mieter__vorname_id = 'fld-ba1a0292eb07418fae85a894f94d6670';
    
        let mieter = record.getFieldValue(mieter_id);
    
        if (!mieter || mieter.length == 0) return '';
    
        // use first tenant
        mieter = mieter[0];
    
        // get names
        const name = mieter.getFieldValue(mieter__name_id);
        const vorname = mieter.getFieldValue(mieter__vorname_id);
    
        // return name
        return vorname + " " + name;
    }
    
    tenant();

    Then add this field in the apartment listing of the house. This way, you see who’s in which apartment, but you don’t have the direct link in the tenant table.

    Attachments:
    You must be logged in to view attached files.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #52620
    Brendan
    Keymaster

    I find ChatGPT very useful sometimes. But often it’s just plain wrong or I guess assumes that because it doesn’t know, then it’s not possible to do something.

    Take a look in the Utils area of the JavaScript API documentation. There’s lots of good stuff in there that Tap Forms can do:

    https://www.tapforms.com/help-mac/pro/en/topic/javascript-api

    #52610
    Mark Moran
    Participant

    I’ve written this javascript to go out and grab sold ebay items and store then in my database. I can’t seem to get it to work. ChatGPT says it because: “Tap Forms JavaScript scripting engine does not have direct HTTP request capability (like fetch or XMLHttpRequest). Scripts are sandboxed and cannot reach out to the web directly.”

    Is this true? Any suggestions on how to get this down if this is the case? I’d like to use the script on my Mac and iOS devices.

    // Define Field IDs from the current form
    const coinTypeFieldId = ‘fld-7b49d2da923f4e90a22c2c43d476504b’;
    const yearFieldId = ‘fld-2196446daf504b619016cf97e293fa00’;
    const mintmarkFieldId = ‘fld-81ea772bc0e24626977c0d2ddece998e’;

    // Defind Field IDs for the Coins on Ebay form
    const Ebay_coin_type_id = ‘fld-1dcc89f4289e482c93cbc940fbe7ca09’;
    const Ebay_mint_mark_id = ‘fld-1e874b9e81c94622837943a57654a563’;
    const Ebay_year_id = ‘fld-2c3a9b6921084f909c69ac90b42335ea’;
    const Ebay_price_id = ‘fld-20c6a1a5d6a74538acccd39458d8c61e’;
    const Ebay_photo_id = ‘fld-e86d4deab234444db94a4b06e731e919’;
    const Ebay_web_site_id = ‘fld-d77c51322b99468193c94ba823fca06b’;

    // Define the Forms
    const coinsWantedForm = document.getFormNamed(‘Coins Wanted’);
    const coinsOnEbayForm = document.getFormNamed(‘Coins on eBay’);

    // Get the current record
    //const currentRecord = form.getRecord();

    // Get the coin search details directly from the record
    const coinType = record.getFieldValue(coinTypeFieldId);
    const year = record.getFieldValue(yearFieldId);
    const mintmark = record.getFieldValue(mintmarkFieldId);

    // eBay API Setup
    const EBAY_AUTH_TOKEN = ‘API TOKEN REDACTED’;

    const query = ${coinType} ${year} ${mintmark};

    // eBay Search URL
    const url = https://api.ebay.com/buy/browse/v1/item_summary/search?q=Lincoln%20Penny%201909%20S&filter=sold_status:SOLD;

    console.log(Searching eBay for: ${query});

    // Async Fetch Wrapper for Tap Forms
    async function fetchEbayData() {
    try {
    const response = await fetch(url, {
    method: ‘GET’,
    headers: {
    ‘Authorization’: Bearer ${EBAY_AUTH_TOKEN},
    ‘Content-Type’: ‘application/json’
    }
    });

    if (!response.ok) {
    throw new Error(HTTP Error: ${response.status});
    }

    const data = await response.json();

    if (!data.itemSummaries || data.itemSummaries.length === 0) {
    console.log(‘No eBay items found.’);
    return;
    }

    // Create Coins Wanted Record
    const wantedRecord = coinsWantedForm.addNewRecord();
    wantedRecord.setFieldValue(coinTypeFieldId, coinType);
    wantedRecord.setFieldValue(yearFieldId, year);
    wantedRecord.setFieldValue(mintmarkFieldId, mintmark);

    // Prepare link field array
    const linkedEbayRecords = [];

    // Process each eBay item
    for (let item of data.itemSummaries) {
    const ebayRecord = coinsOnEbayForm.addNewRecord();
    ebayRecord.setFieldValue(Ebay_coin_type_id, coinType)
    ebayReocrd.setFieldValue(Ebay_year_id, year)
    ebayRecord.setFieldValue(Ebay_mint_mark_id, mintmark)
    ebayRecord.setFieldValue(Ebay_price_id, item.price.value);
    ebayRecord.setFieldValue(Ebay_web_site_id, item.itemWebUrl);

    // Save all available photos
    let allPhotos = [];

    // Add the main image
    if (item.image && item.image.imageUrl) {
    allPhotos.push(item.image.imageUrl);
    }

    // Add additional images if available
    if (item.additionalImages && item.additionalImages.length > 0) {
    item.additionalImages.forEach(img => {
    if (img.imageUrl) {
    allPhotos.push(img.imageUrl);
    }
    });
    }

    // Save all photos to the Photo field (must be a Photo field that accepts multiple items)
    ebayRecord.setFieldValue(Ebay_photo_id, allPhotos);

    // Save all photos (only saves the featured photo)
    // if (item.image && item.image.imageUrl) {
    // ebayRecord.setFieldValue(‘fld-ebay-photo-id’, [item.image.imageUrl]);
    // }

    linkedEbayRecords.push(ebayRecord);
    }

    // Link eBay records to Coins Wanted
    wantedRecord.setFieldValue(‘Coins on Ebay’, linkedEbayRecords);

    console.log(Found and linked ${linkedEbayRecords.length} eBay items.);

    } catch (error) {
    console.error(‘eBay API Error:’, error);
    }
    }

    // Start the async function
    fetchEbayData();

    #52597

    In reply to: Cascading Pick Lists

    Brendan
    Keymaster

    At the moment, no. I haven’t exposed the values relationship of a Pick List value to JavaScript yet.

    But I did just add the APIs to expose them to JavaScript.

    Will be in the next build (1.0.7) that I’m working on.

    #52593
    timzu
    Participant

    Does anyone know if there would be a way through scripting (or some other way) to change rating stars into another type of shape? Like if I wanted it to just be a rectangular block?

    #52587

    In reply to: Autofill advice

    Daniel Leu
    Participant

    1) change the double-quotes to single-quotes.
    2) since it’s a field script, you should not need the record.setFieldValue() since the return value is what is used.

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    #52584

    In reply to: Autofill advice

    Mark Moran
    Participant

    Just came back here to say it’s not updating. It is setup as a field script (see attachment). According to the docs anytime I change the Coin Type it should run the script, no? It’s not, I have to manually click the “play arrow” on the script to get the field to update.

    • This reply was modified 6 months, 3 weeks ago by Mark Moran.
    Attachments:
    You must be logged in to view attached files.
Viewing 15 results - 106 through 120 (of 2,990 total)