Streaming live at 10am (PST)

Use the input from the form for cms


#1

Hi,

  1. is it possible to get the input from a user that fill a form and create a new cms record automatically?
  2. is it possible to get the input from a user that fill a form and use it to a link of a button, for example, the user fills a phone number and when he submitted it will take him to the link will be sms://[phone number the entered]

#2

Hey,

I think the answer you are looking for is in this video it is within the first 18 minutes.
https://www.youtube.com/watch?v=I8zl6qLbm3k "

for you second question i dont have an answer but i will let you know when i think of one :slight_smile:


#3

thanks, do you know if it will work with image upload?


#4

i think so,
When the cms api was just new i tried a few things but not sure if images are supported but i think so :smiley:
Good luck

Tonight i will ask my wife if she has a sollution for you phone number question :slight_smile:


#5

you are awsome! thanks


#6

Hi @argogiant
any solution?


#7

('.buttonclass').on('click, touchstart', function(){ var telNr = (’#telNrinputfield’).val();
window.location = ‘sms://’+telNr;
});

you’ll need to add jquery:

https://www.w3schools.com/jquery/jquery_get_started.asp


#8

Yes, but you would likely need some back end logic. You could have a form submission webhook that triggers a new CMS item to be created using the CMS api. This would definitely require some development skills.

If I understand your question correctly, yes. If the place that you need to display the telephone number is on the same page as the form, then you could just get the input’s value with document.getElementById('phoneInput').value , otherwise if it’s on a second page you would probably need to pass the value over by using a URL query string like https://yoursite.com/nextpage?phone=123456789

Hope that helps.
Jason


#9

where do I need to put this row? where do I write it?
sorry for my poor knowledge on development (and my English haha)


#10

This is custom code, so you would need to wrap it in script tags and put in somewhere in your site (like a script embed or in the page footer code).

When someone clicks the form submit button, this example function grabs the input value and prepopulates another text input with its value:

<script>
    document.getElementById('submitButton').addEventListener('click', prepopulateField);

    function prepopulateField() {
        var phoneNumber = document.getElementById('phoneInput').value;
        var newField = document.getElementById('newField');
        newField.value = phoneNumber;
    }
</script>

document.getElementByID('submitButton') is referencing the form submit button. You need to make sure that you set element IDs within the Webflow designer for this to work. I made a video series on setting up user auth with a Webflow site where I show how to do this, you might find it useful.

Jason