I followed the http://msdn.microsoft.com/en-us/library/cc264294%28v=office.12%29 making a new SP project with the under _layouts. the control renders fine, and i can select files, however when I click upload it shows the little loading icons. with no files uploaded.
<LINK REL="stylesheet" TYPE="text/css" HREF="/_layouts/1033/styles/ows.css">
<SCRIPT LANGUAGE="javascript">
function MultipleUploadView() {
document.all.idUploadCtl.SetTreeViewColor("#FF0000");
document.all("idMultipleView").style.display = "inline";
}
function DocumentUpload() {
document.all.idUploadCtl.MultipleUpload();
}
</SCRIPT>
<FORM NAME="frmUpload" METHOD="post"
ACTION="upload.aspx?RootFolder=& Source=http://jono-pc/Shared Documents/Forms /AllItems.aspx">
<SharePoint:FormDigest ID="FormDigest1" runat="server" />
<INPUT TYPE="hidden" NAME="Cmd" VALUE="Save">
<INPUT TYPE="hidden" NAME="NextUsing"
VALUE="http://jono-pc/Shared Documents/Forms/AllItems.aspx">
<INPUT TYPE="hidden" VALUE="New">
<INPUT TYPE="hidden" NAME="putopts" VALUE="true">
<INPUT TYPE="hidden" NAME="destination"
VALUE="http://jono-pc/Shared Documents">
<INPUT TYPE="hidden" NAME="Confirmation-URL"
VALUE="http://jono-pc/Shared Documents/Forms/AllItems.aspx">
<INPUT TYPE="hidden" NAME="PostURL"
VALUE="http://jono-pc/_vti_bin/shtml.dll/_layouts/upload.aspx" />
<INPUT TYPE="hidden" NAME="VTI-GROUP" VALUE="0">
<P CLASS="ms-toolbar">
<A HREF="javascript:MultipleUploadView()"
TARGET="_self">Upload Multiple Files</A>
</P>
<DIV ID=idMultipleView style='display:none'>
<P CLASS="ms-toolbar">
<A HREF="javascript:DocumentUpload()"
TARGET="_self">Save and Close</A>
</P>
<OBJECT id=idUploadCtl name=idUploadCtl
CLASSID=CLSID:07B06095-5687-4d13-9E32-12B4259C9813
WIDTH='100%' HEIGHT='350px'>
</OBJECT>
</DIV>
</FORM>
Finally found the answer to this dilemma (hint provided by an old SP bug: http://support.microsoft.com/kb/2489168) The input values must be relative URLS because SharePoint Office 2010 appends the http:// to all the values. so if you have a full URL it will append the http:// twice. Once I changed to relative paths, it uploaded fine.
Related
I got redirected after I submit the form, and I want to remain on the same page. I am not sure why I got redirected, I am not using &redirectTo for this.
I try some things but nothing worked till now.
[[!FormIt?
&hooks=`spam,email,FormItSaveForm,successMess`
&formName= `Contact Form`
&emailTpl=`emailChunkTpl`
&emailTo=`email#gmail.com`
]]
<form action="[[~[[*id]]]]" method="post" class="contactForm">
<input type="hidden" name="nospam:blank" value="" />
<div class="row input-section-child">
<div class="col input-contact">
<input value="[[!+fi.input-name]]"class="input-name" name="input-name" id="input-name" type="text" placeholder="your name" />
<span class="error-message error" > [[!+fi.error.input-name]] </span>
<input value="[[!+fi.input-email]]" class="input-email" name="input-email" id="input-email" type="text" placeholder="email address" />
<span class="error-message error" >[[!+fi.error.input-email]] </span>
</div>
<div class="col input-contact-text">
<input value="[[!+fi.input-textare]]"class="input-textare" name="input-textare" id="input-textare" type="textare" placeholder="message" />
</div>
</div>
<div class="row second-row">
<div class="col">
<button type="submit" class="send-button">SEND</button>
</div>
[[+placeholder]]
</div>
</div>
</from>
As in my answer on your other post, you should remove all the hooks and try one at a time (after you've cleaned up the markup for this form).
And what is successMess? Is that a custom snippet you've made? It's not a Formit hook that I have heard of. If it's your custom snippet you should paste the code into your question so we can see it.
I'm trying to get filtered data from a webform more quickly. Basically I want to use URL input to specify a date and to precheck a checkbox. I'm getting stuck with how to specify the check box as I'm not sure what the value should be.
<form action="/xxx/yyy" class="form-inline d-flex justify-content-end" method="get"> <div class="input-group input-group-lg mb-2">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-calendar"></i></span>
</div>
<input type="text" name="from" value="" class="form-control datetimepicker-input" id="datetimepicker7" data-toggle="datetimepicker" data-target="#datetimepicker7" autocomplete="false">
<div class="input-group-append">
<button type="submit" class="btn btn-dark"><i class="fas fa-arrow-right"></i></button>
</div>
</div>
</form>
####snip and skip to the part of the form I wish to pre-check####
<fieldset id="departureGatewayFilters">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="AMS" id="departureGatewayCheck_AMS">
<label class="form-check-label" for="departureGatewayCheck_AMS">
AMS
</label>
</div>
So far I'm using URL string: /xxx/yyy?from=2020-03-05 - what would I need next to pre-check the checkbox as well?
Thanks in advance!
Clare
Getting your checkbox checked and also getting value of the checkbox just through URL string is little bit troublesome. But you can try this :
You can assign unique name to the checkbox.
<input class="form-check-input" type="checkbox" name="checkbox_1" id="departureGatewayCheck_AMS">
And then what you can do is pass the value of checkbox through URL string. For example :
/xxx/yyy?from=2020-03-05&checkbox_1=test.
Now, using javascript you can parse URL strings and get your search params, compare it and get your checkbox checked.
<script lang="javascript">
var url_string = window.location.href ; //gets current URL
var url = new URL(url_string); // instantiate string as URL object
var c = url.searchParams.get("checkbox_1"); //get the params
if(c == "test") {
document.getElementById("departureGatewayCheck_AMS").checked = true; //checks your checkbox
}
</script>
Hope it helps ! Have a good day!
I think all you need to do is add a (checked="true") argument to your input tag your code should look like this then:
<div class="form-check">
<input class="form-check-input" checked="true" type="checkbox" value="AMS" id="departureGatewayCheck_AMS">
<label class="form-check-label" for="departureGatewayCheck_AMS">
AMS
</label>
</div>
Hope this helps
If you want to make the checkbox departureGatewayCheck_AMS checked by default, it is sufficient to edit its code like this:
<input class="form-check-input" type="checkbox" value="AMS" name="departureGatewayCheck_AMS" id="departureGatewayCheck_AMS" checked> AMS
If the checkbox is selected, since its "value" attribute is "AMS",your url (if you submit the form via GET) would be something like:
/xxx/yyy?from=2020-03-05&departureGatewayCheck_AMS=AMS
Complete solution for your requirement:-
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css" integrity="sha256-yMjaV542P+q1RnH6XByCPDfUFhmOafWbeLPmqKh11zo=" crossorigin="anonymous" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
<div class="container">
<form class="form-inline d-flex justify-content-end" method="get"> <div class="input-group input-group-lg mb-2">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-calendar"></i></span>
</div>
<input type="text" name="from" value="" class="form-control datetimepicker-input" id="datetimepicker7" autocomplete="false">
<div class="input-group-append">
<button type="submit" class="btn btn-dark"><i class="fas fa-arrow-right"></i>
</button>
</div>
</div>
<fieldset id="departureGatewayFilters">
<div class="form-check">
<input class="form-check-input" name="checkname" type="checkbox" value="AMS" id="departureGatewayCheck_AMS">
<label class="form-check-label" for="departureGatewayCheck_AMS">
AMS
</label>
</div>
</fieldset>
</form>
</div>
</body>
<script type="text/javascript">
$(function () {
var url_string = "https://www.example.com/page?from=2020-12-12&checkname=1";//window.location.href ; //gets current URL
var url = new URL(url_string); // instantiate string as URL object
var date=url.searchParams.get("from");
var check = url.searchParams.get("checkname"); //get the params
alert(date);
alert(check);
if(check) {
$( "#departureGatewayCheck_AMS" ).prop( "checked", true );
}
$('.datetimepicker-input').datetimepicker({
format: 'YYYY-MM-DD',
defaultDate: date,
});
});
</script>
To reduce load blocking I decided to convert the following google custom adsense search code...
<form action="http://www.google.ru" id="cse-search-box" class="form-search">
<div>
<input type="hidden" name="cx" value="partner-pub-7920375793574512:1188291711" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" size="55" />
<input type="submit" name="sa" value="Найти" class="btn btn-info" />
</div>
</form>
<script type="text/javascript" async src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script>
<script type="text/javascript" async src="http://www.google.com/cse/t13n?form=cse-search-box&t13n_langs=en"></script>
<script type="text/javascript" async src="http://www.google.ru/coop/cse/brand?form=cse-search-box&lang=ru"></script>
... to (I just removed scripts to require js load style)
<form action="http://www.google.ru" id="cse-search-box" class="form-search">
<div>
<input type="hidden" name="cx" value="partner-pub-7920375793574512:1188291711" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" size="55" />
<input type="submit" name="sa" value="Найти" class="btn btn-info" />
</div>
</form>
... and require js module:
var scripts;
scripts = ['http://www.google.com/jsapi', 'http://www.google.com/cse/t13n?form=cse-search-box&t13n_langs=en', 'http://www.google.ru/coop/cse/brand?form=cse-search-box&lang=ru'];
define(scripts, function() {
return google.load("elements", "1", {
packages: "transliteration"
});
});
And got unpredicted result:
when page is loading first it is ok, but then I see white screen without any html element and no errors in google chrome console.
So loading google scripts in require js module breaks all html. Why it is so?
I added window. in line
return google.load("elements", "1", {packages: "transliteration"});
so got line:
return window.google.load("elements", "1", {packages: "transliteration"});
And all works fine.
Full code of require.js module:
var scripts;
scripts = ['http://www.google.com/jsapi', 'http://www.google.com/cse/t13n?form=cse-search-box&t13n_langs=en', 'http://www.google.ru/coop/cse/brand?form=cse-search-box&lang=ru'];
define(scripts, function() {
return window.google.load("elements", "1", {
packages: "transliteration"
});
});
Please consider the following (Issue is, the results of the Google Search on our page is not registering within our Google Analytics Account):
HTML FORM:
<div style="float:right; margin-right:12px;">
<form id="cse-search-box" name="srchfrm" action="http://google.com/cse" target="_blank" onsubmit="validatesearch()">
<input value="999999999999999999999:srraaaaaaaa" name="cx" type="hidden"/>
<input id="q" name="q" type="text" onKeyPress="return submitenter(this,event)" placeholder="Search"/>
<a href="javascript:;" onmouseover="MM_swapImage('go','','/btn_go_on.gif',1)" onmouseout="MM_swapImgRestore()" />
<input type="image" src="/btn_go.gif" alt="Go" width="20" height="21" border="0" align="top" id="go"/>
<input value="UTF-8" name="ie" type="hidden"/>
</form>
</div>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('search', '1');
google.setOnLoadCallback(function() {
google.search.CustomSearchControl.attachAutoCompletion(
'999999999999999999999:srraaaaaaaa',
document.getElementById('q'),
'cse-search-box');
});
</script>
URL ON EXECUTING A SEARCH:
http://www.google.com/cse?cx=999999999999999999999:srraaaaaaaa&q=test+search&x=12&y=11&ie=UTF-8&oq=&gs_l=#gsc.tab=0&gsc.q=test%20search&gsc.page=1
QUERY PARAMETERS BEING USED:
q
query (I read in another post to try this)
Thank you for all the help in advance!
By changing:
action="http://google.com/cse"
within,
<form id="cse-search-box" name="srchfrm" action="http://google.com/cse" target="_blank" onsubmit="validatesearch()">
to redirect to a page within the website, this resolved the issue.
Working code:
<div style="float:right; margin-right:12px;">
<form id="searchbox_99999999999999999999:srraaaaaaaa" name="srchfrm" action="/search" target="_self" onsubmit="validatesearch()">
<input value="99999999999999999999:srraaaaaaaa" name="cx" type="hidden"/>
<input id="q" name="q" autocomplete="off" type="text" onKeyPress="return submitenter(this,event)" placeholder="Search"/>
<input name="ie" value="UTF-8" type="hidden"/>
<a href="javascript:;" onmouseover="MM_swapImage('go','','/btn_go_on.png',1)" onmouseout="MM_swapImgRestore()" />
<input type="image" src="/btn_go.png" alt="Go" width="20" height="21" border="0" align="top" id="go"/>
</form>
</div>
The Search Page itself has the following code as per Google documentation:
HEAD:
<script>
(function() {
var cx = '99999999999999999999:srraaaaaaaa';
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
})();
</script>
BODY:
<gcse:searchresults-only></gcse:searchresults-only>
I'm using Joomla jQuery Registration extension which comes without any kind of botcheck feature and I'd like to add it but I don't know how I'd go about doing that. Here is the extension's code:
<?php
/**
* #title jQuery Dropdown Registration Module
* #version 1.7.2
* #package Joomla
* #author http://www.minitek.gr (Ioannis Maragos)
* #copyright Copyright (C) 2011 Minitek. All rights reserved.
* #license GNU General Public License version 2 or later.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
<?php JHTML::_('behavior.formvalidation'); ?>
<?php /*<link rel="stylesheet" href="modules/mod_dropdown_registration/css/style.css" type="text/css" /> */?>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js?ver=1.4.2" type="text/javascript"></script>
<script src="modules/mod_dropdown_registration/js/register.js" type="text/javascript"></script>
<?php
$user = JFactory::getUser();
$myID = $user->id;
if ($myID == 0) {
?>
<div id="registerContainer">
<span>Registracija</span><em></em>
<div style="clear:both"></div>
<div id="registerBox">
<form id="member-registration" action="<?php echo JRoute::_('index.php?option=com_users'); ?>" method="post" class="form-validate">
<fieldset id="reg-body" class="userdata">
<div class="reg-field">
<label for="jform_name" id="jform_name-lbl">
Ime i prezime:
</label>
</div>
<div style="float:left;">
<input type="text" maxlength="50" class="inputbox required" value="" size="40" id="jform_name" name="jform[name]"/><br/>
Molimo Vas da unesete stvarno ime i prezime!
</div>
<div style="clear:both;"></div>
<div style="height: 7px;"></div>
<div class="reg-field">
<label for="jform_username" id="jform_username-lbl">
Korisničko ime:
</label>
</div>
<div style="float:left;">
<input type="text" maxlength="25" class="inputbox required validate-username" value="" size="40" name="jform[username]" id="jform_username"/>
</div>
<div style="clear:both;"></div>
<div class="reg-field">
<label for="jform_password1" id="jform_password1-lbl">
Lozinka:
</label>
</div>
<div style="float:left;">
<input type="password" value="" size="40" name="jform[password1]" id="jform_password1" class="inputbox required validate-password"/>
</div>
<div style="clear:both;"></div>
<div class="reg-field">
<label for="jform_password2" id="jform_password2-lbl">
Potvrdite lozinku:
</label>
</div>
<div style="float:left;">
<input type="password" value="" size="40" name="jform[password2]" id="jform_password2" class="inputbox required validate-password"/>
</div>
<div style="clear:both;"></div>
<div class="reg-field">
<label for="jform_email1" id="jform_email1-lbl">
E-mail:
</label>
</div>
<div style="float:left;">
<input type="text" maxlength="100" class="inputbox required validate-email" value="" size="40" name="jform[email1]" id="jform_email1"/>
</div>
<div style="clear:both;"></div>
<div class="reg-field">
<label for="jform_email2" id="jform_email2-lbl">
Potvrdite e-mail:
</label>
</div>
<div style="float:left;">
<input type="text" maxlength="100" class="inputbox required validate-email" value="" size="40" name="jform[email2]" id="jform_email2"/>
</div>
<div style="clear:both;"></div>
<br/>
<font color = "#FF0000">Sva polja su obavezna!</font><br/>
<br/>
<button type="submit" class="button validate">Registracija</button>
<input type="hidden" name="option" value="com_users" />
<input type="hidden" name="task" value="registration.register" />
<?php echo JHtml::_('form.token');?>
</fieldset>
</form>
</div>
</div>
<?php
}
?>
I'm sorry if doesn't come out as a code block but the instructions are unclear. Anyhow - what I'd like to do is add a text field before the Submit button which will have something like a "What is 3 plus 2" label in front of it, and the submit won't work if the answer is incorrect. Is there any way to do this without editing Joomla core files?
You could user jQuery to add your label and input elements to the page. Then bind a .click() listener to the submit button that checks the validity of your answer before the form can be submitted. Do not that this is not a very secure bot checking solution. To add an extra level of security you might consider changing the 2 and 3 to two and three and also perhaps alternate between plus, minus, multiply and divide and store the answers and question combos in your Joomla session instead of calculating it all in JS.