How do I make a link that pre-fills a form checkbox? - forms

I have a page called contact.htm with a working form. One of the checkbox fields on the form is named Garden (so either it is checked or not when using the form).
I have another page that I want to link to my form page, so that if a user clicks a particular link, they are sent to the form page and the field Garden is pre-clicked.
I have not been able to do this though I have tried several methods...such as:
a href="contact.htm?checkbox=Garden,on" or
a href="contact.htm?checkbox=Garden,checked" or
a href="contact.htm?input type="checkbox" name="Garden" value="checked", and some others.
I would appreciate any help.

You'll need to use JavaScript on the target webpage to process the argument and fill the values in. There is no automatic way of doing this just by URL.
This link shows how to retrieve URL arguments from JavaScript. From there, it's a matter of using standard JavaScript or JQuery to fill the values in.

Related

Pass/give something other than a form to the POST request

I'm doing a form where when you select an option (with the and tag), a text below the form change according to the choice.
I would like to have this text along with my form data when send to a POST request.
I'm using Express and EJS.
Btw I also have GET parameters and would like the same thing as the text, any thoughts ?
Can you help me please ?
Thanks !
Whatever code you have that changes the text according to your choice, can also set a hidden form value in your form to the same value. That hidden form value will not display to the end user in the browser, but will be sent with the form as part of the POST (as another value of the form).
Here's an example of a hidden form element from that previous linked reference:
<input type="hidden" id="custId" name="custId" value="3487">
If this is inside your <form>, you can then change it with your Javascript to whatever you want it to and it will be automatically sent to your server as one of your form values when the form is POSTed to your server, but won't be shown to the user because of the type="hidden".

Using spfx webparts, would there be a way to either programmatically send an email which has a link to open a modal or using flow?

I want an spfx made webpart that I've made be able to send an email (I'm using IEmailProperties at the moment) which provides a link to a modal form?
For example:
User clicks button in webpart, form loads.
User fills out form and submits it to SP list.
Form sends email on submission. Email has a link to the actual item created, so when the user clicks the provided email link, it opens up the modal form.
I would presume that the user would HAVE to be sent to the SP page where the webpart is unconditionally, but would it be possible to open up the modal corresponding to the SP list item?
Is this feature available in SharePoint framework, because if it isn't, compared to something like InfoPath 2013 or PowerApps it's quite a limitation.
I've researched this with several shallow Google searches and on gitHub for any premade stuff, but alas there is nothing that I've spotted.
I've been told IT IS possible:
"Yeah, they’d have to visit the page. Email clients don’t do JavaScript so you can’t really do interactive stuff there. If you want to take them directly to a page that then displays a modal, that’s plenty possible though. (e.g. display the modal based on if the URL contains a certain string)"
But wouldn't know how to do the above, can anyone start me on the right path?
Regards,
T
In the email, pass a query string containing the item ID/list ID etc of the item, then have the webpart read the See: How can I get query string values in JavaScript? If your values exist. If they do exist, then open the modal using some kind of framework like bootstrap or fluent UI. You can write your own form using PnPjs or use an iframe potentially to display the OOTB edit form.
Additionally, you can link to any page in SharePoint provided you use an extension instead of a webpart to host the modal. You can install extensions tenant wide, and have it listen for the query string.

Wicket: Loosing form input on page re-render

I have pages with forms. Everything is working fine. Except, that there is a link (language selecter) on the pages. The requirement is, that when the user has already input in the form fields and than (without submitting the form) is clicking the link, all input should be retained.
If the link would be part of the form, this could easily archived via a SubmitLink and submitLink.setDefaultFormProcessing(false);
Unfortunately, this link has no knowledge of the form(s) on this page.
Any pointers if this is solvable? Of course, validation should not be triggered.
client-side JavaScript solution
wrap complete page content in a form
(yes, Wicket allows nesting of forms) and use an SubmitLink with
defaultFormProcessing=false
add an AjaxFormComponentUpdatingBehavior
to all your form fields, so the input is always sent to the server

What portions of the marketo code snippet can change?

My company is using marketo forms, and we are generating the page from a content management system.
We'd like to keep the contribution experience as simple as possible and prevent the user from contributing actual <script> tags.
The API documentation says they will give you a block of code that looks like this:
<script src="//app-sjqe.marketo.com/js/forms2/js/forms2.js"></script>
<form id="mktoForm_621"></form>
<script>MktoForms2.loadForm("//app-sjqe.marketo.com", "718-GIV-198", 621);</script>
My question is, what portions of this code are subject to change?
I am sure the 3 part hypen separated string and the integer being passed in can change.
What about the app-sjqe.marketo.com address?
The 3-part string is your Marketo instance ID, and shouldn't really change. The other integer is the form ID, which definitely will change depending on what form you want to embed.
The other thing that you may want to consider, is the other configurable options that you can send along with the form embed. For example, in the module that I have made for my CMS, I let the user put an optional 'thank-you' page URL, to redirect the form to after submission, and also a checkbox to optionally open the form in a lightbox on page load.
The simple module I made is for the Sitefinity CMS - happy to share code with you if that helps!

Zend Framework: How to POST data to some external page (e.g. external payment gate) without using form?

I would like to have a user redirected to an external credit card gate. Of course I have to POST some user info to that gate, but I don't know how exactly can I do this.
I know that I could do this by generating a html form with hidden or read-only fields and have a user click "Submit" button. But this solution is not perfect, because all the form data could be easily changed using e.g. Firebug. I think you cannot do this using $this->_redirect(...). But maybe there is some other solution?
Many thanks for any tips or suggestions.
I would like to have a user redirected to an external credit card gate. Of course I have to POST some user info to that gate, but I don't know how exactly can I do this.
Using a form is the only method available. The RFC states that the user should explicitly agree to sending a POST (i.e. click on a submit button).
I know that I could do this by generating a html form with hidden or read-only fields and have a user click "Submit" button. But this solution is not perfect, because all the form data could be easily changed using e.g.
It is no more secure that using a redirect as the header data can be modified without too much of a problem. There are even Firefox plugins to do it.
use cURL to post data
http://framework.zend.com/manual/en/zend.http.client.adapters.html