top of page

Forum Comments

Using UpdateMember Function
In Coding with Velo
how to count unique entries in database
In Coding with Velo
Creating Member Profile custom fields with radio buttons and drop down menus
In Coding with Velo
Code-Ninja
Top Contributor
Top Contributor
Jun 27, 2023
Your description is a little bit confusing, you jump back and forthn in your description. So what is exactly your aim ? Generting a CUSTOM FORM (icluding some Ragdio-Buttons, or even Radio-Button-Groups) ???  I need to know if my customer is right or left handed. Much better to have radio buttons for this as opposed to a text box. yes --> that's of course right! I think you have more difficulties than just creating a custom FORM. Your difficulty is, that you can't work with the MEMBER-PROFILE (not enough knowledge). 1. First find the DATABASE, where all that data is stored. 2. Find out how to get those data out of the mentioned database. 3. Once you have the data inside a variable (OBJECT), you can do whatever you want with this gotten data. So one more time, i would say, your first task is to find out how to work with MEMBER-PROFILE. Just typed in --> "member profile" into the search and let's see one of first results.... https://community.wix.com/velo/forum/coding-with-velo/link-to-private-member-profile-page Ok, you should take care not to learn from old posts, like shown here, since such old posts probably uses OLD AND DEPRICATED API, like in this example (Wix-Users-API). But doing a little bit more of RESEARCH --> you surely would find much more info about your issue. You also do not present your whole setp. -anyone can see your form -you can describe a lot --> but normaly a pic can show more than 1000-words, so why you just don't show a pic of... a) your setup b) related database c) eventualy your connected dataset (if you use one) d) all other relevant infos, related to your issue. This would make it easier to solve your problem. Don't forget, it's only you who has the complete project infront of your eyes.
1
2
Button deactivation
In Coding with Velo
Code-Ninja
Top Contributor
Top Contributor
Jun 22, 2023
The following code was tested.... and works like it should.... $w.onReady(()=>{let counter = 0; let btnAccept = $w('#btnCvCreationTool'); btnAccept.onClick((event)=>{ console.log(event.target.id+"-clicked-"+counter); counter = counter +1; if (counter >=5) {btnAccept.disable();} else {btnAccept.enable();} }); }); As we can see inside the console, i was able to click only 5-times onto the button, until the button had been deactivated.... That was my testing button, somewhere on one of my running projects... After 5-clicks it got disabled.... Of course your button will be REENABLED again, if you ... ---------------> REFRESH THE PAGE <-------------- And now you should think about a database --> which saves all the clicks of each users, who visits your site. 1. User-A visit your site and clicks 4-times, before leaving your page. 2. User-B visit your site and clicks 3-times, before leaving your page. 3. User-C visit your site and clicks 5-times, before leaving your page. All of this users, would automaticaly refresh the button, and the button would work again and again, if you do not save the current state of the button for each of the users. But how to do? What do you need to achieve such functionality? 1. First you should be able to get the ID of current user. 2. You should be able to get the amount of clicks of current user. 3. You should be able to save the current amount of clicks to your DB for each user. 4. You should be able to load the data for each user automatically when the page gets ready (including your BUTTON). What would be the code-flow... 1. User logs in ---> you get his ID 2. Now when you know users ID --> loading the data of this user including the AMOUNT of CLICKS, from your DATABASE. 3. Running an IF-ELSE-CONDITION to check if the AMOUNT is smaller, equal, or even bigger than 5. 4. if (...) {...} else {...} 5. Accordingly disable or enable the button. 6. At same time after every click onto your button you should save the current amount of clicks back to your database. This would make sure, that the clicked button-amount never would get lost, since it is saved inside your database for each of users. Now your turn ---> generate all the functions and solve your issue. EDIT: ADDITIONAL-TIP: If you want to know if the code has any errors or TYPOS, just paste the code into your Wix-Editor into the code-section and all the ERRORS will be marked --> RED! As we can see ---> conter <--- was a real TYPO !!! Instead of --> conter <-- of course it should be ---> counter <--- Now you should have enough informations, to be able to solve your issue by your own. Code-Ninja
Content media
How to add a class to the body element?
In Coding with Velo
Code-Ninja
Top Contributor
Top Contributor
Jun 21, 2023
Ok, as i understood you want to send your data over to the HTML-WINDOW (HTML-CODE-WORLD), which seems to be your favourite one. Where you want to genrate your own custom HTML+CSS-CODE. As i already told, there are several options. a) HTML-COMPONENT b) Custom-Element c) Inside Dashboard (Custom-Code) It seems like you are not really a beginner in coding, just the VELO-WORLD is new for you, but not coding at all. You seems to know how to work with HTML and the DOM. At least i can see, that you have already some coding skills, or you understand things very fast. Your steps for your solution would be..... 1. User Logs in 2. Authentication-process running (backend or frontend) 3. You get response if user is logged-in or not (boolean-value --> true/false) 4. Now comes the more difficult part, sending it over to the HTML-WORLD 5. This for i will use a HTML-Component in this example.... You will have to take a look onto this example, wich will show you the right way of how to do it and how to bring your wished function in action.... https://www.wix.com/velo/reference/$w/htmlcomponent/onmessage Read more about the HTML-Component in the introduction of the related API-Docs. ATTENTION: To be able to use the HTML-Component, you will need to have a PREMIUM Wix-Site. It won't work on FREE-Wixsites. The same you will be able to generte, by using a CUSTOM-ELEMENT. Custom-Element will be the better option, but HTML-Component also should do the trick. Good luck!!!!

Code-Ninja

Top Contributor
+4
More actions
bottom of page