|
hi,
am having
<div id="create"/>
then in script
$('create').jtable('showCreateForm');
its not opening the jtable add new record form.
how to solve it
thanks in advance..
modified 10-Feb-16 3:47am.
|
|
|
|
|
$('#create').jtable('showCreateForm');
|
|
|
|
|
yes...tried with that but error in console is:
$(..).jtable is not a function
|
|
|
|
|
|
in the below code iframe is using to upload file to server. see the code and tell me when iframe load event is fired ?
<script type="text/javascript">
$(document).ready(function () {
$("#formsubmit").click(function () {
var iframe = $('<iframe name="postiframe" id="postiframe" style="display: none"></iframe>');
$("body").append(iframe);
var form = $('#theuploadform');
form.attr("action", "/upload.aspx");
form.attr("method", "post");
form.attr("encoding", "multipart/form-data");
form.attr("enctype", "multipart/form-data");
form.attr("target", "postiframe");
form.attr("file", $('#userfile').val());
form.submit();
$("#postiframe").load(function () {
iframeContents = this.contentWindow.document.body.innerHTML;
$("#textarea").html(iframeContents);
});
return false;
});
});
</script>
code taken from here http://stackoverflow.com/questions/7909161/jquery-iframe-file-upload
the above code dynamically creating iframe and append to body and submitting the form. how the above code file is uploading to server by iframe not clear?
what is relation between file upload and iframe in above code ?
when iframe load will call ?
$("#postiframe").load(function () {
iframeContents = this.contentWindow.document.body.innerHTML;
$("#textarea").html(iframeContents);
});
help me in details.
thanks
tbhattacharjee
|
|
|
|
|
The form on the page is having it's action set to be the iframe which means when the form is submitted it doesn't load in the browser, but instead the form is submitted to, and ergo upload.aspx is loaded, in the iframe. This lets the page remain without being refreshed.
|
|
|
|
|
just do not understand the objective behind it. can u explain with easy sample code. thanks
tbhattacharjee
|
|
|
|
|
It's a way of uploading a file without leaving the page. If you had an form like this
<form action = "upload.aspx" method="post">
</form>
and you submit that form you get a page refresh. If you do
<iframe name="myiframe"></iframe>
<form action = "upload.aspx" method="post" target="myiframe">
</form>
when you submit the form the browser keeps on the current page but the form is submitted to the iframe. If the iframe is hidden then the user doesn't see anything, the file is uploaded silently.
|
|
|
|
|
thanks a lot
tbhattacharjee
|
|
|
|
|
Hi am kind of New to using Javascript, please can i get help on a javascript function that will pick the value in textbox2 and get 70% of it and drop it into textbox4 at the same time disable textbox3,my codes are below.Thank you
<asp:gridview id="Gridview1" runat="server" showfooter="true" autogeneratecolumns="false"
="" font-size="X-Small">
<Columns>
<asp:BoundField DataField="RowNumber" HeaderText="S/N" />
<asp:TemplateField HeaderText="NAME">
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ASSESSMENT1">
<ItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Width="40px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ASSESSMENT2">
<ItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Width="80px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="LEVEL">
<ItemTemplate>
<asp:DropDownList ID="dropdownlist1" runat="server" Width="100px">
<asp:ListItem Value="-1">Select</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SESSION">
<ItemTemplate>
<asp:DropDownList ID="dropdownlist2" runat="server" Width="150px">
<asp:ListItem Value="-1">Select</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="TOTAL">
<ItemTemplate>
<asp:TextBox ID="TextBox4" runat="server" Width="80px"></asp:TextBox>
</ItemTemplate>
<FooterStyle HorizontalAlign="Right" />
<FooterTemplate>
<asp:Button ID="ButtonAdd" runat="server" Text="Add New Row" OnClick="ButtonAdd_Click"
Width="80px" Font-Size="X-Small" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
|
|
|
|
|
First up - it is a very good idea to rename TextBox1 to something like descriptive like TextBoxName etc. I used to teach development and it never ceased to amaze me how many students wouldn't descriptive naming because using the default is "quicker". They would, however, happily deal with mental effort required to remember TextBox14 was the Address City and were seemingly even more happy to spend time in a practical exam debugging the fact they'd mis-typed TextBox11 where they needed TextBox1 .
Anyway, rant over . To start you off on your actual question: You can use JavaScripts getElementById()[^] to do what you want, but the problem is .net will replace the ASP.net the ID you specified with a one generated from the ID you supplied plus the IDs of its parent controls (something like Form1_GridView1_TextBoxAssessment1 I forget the exact format ). This is done to try to ensure ID uniqueness in the HTML. To compensate, you embed you JS inside ASP:
<script type="text/javascript">
document.getElementById("<%= TextBoxAssessment1.ClientID %>")
.onchange=function(){
};
</script>
Assuming you've re-named your textBox2 to TextBoxAssessment1 . getElementById() does what it says on the tin, getting the element by its ID, onchange() detects changes to the value.The <%= TextBoxAssessment1.ClientID %> does the magic of working out the ID of your control as rendered on the browser.
|
|
|
|
|
Hello everybody,
I have a Calendar in my page and I want to check if users select Saturday or Sundays, with getDay() function I can check day number, but I find out depend on operating system setting I get different number for Saturday or Sunday. So how is a proper way I can check this and be sure it is secure for every operating system settings.
Regards
Mazy
"This chancy chancy chancy world."
|
|
|
|
|
That's odd behaviour - can you post the code please, including where you Parse the date out (if applicable, including date format)? In any case it probably isn't an OS thing, but a timezone/localisation problem (which happen to be different on the two OSs you are trying).
In the mean time you can try getUTCDay() , but I doubt it'll fix your problem.
|
|
|
|
|
Thanks, Yes it can be for timezone/localisation problem too. Here is my code:
function ff_bfQuickMode7256046_validation(element, message)
{
if(element.value == '' )
return 'Please select a date for your apppointement.\n';
var myday = new Date(element.value) ;
myday.setDate(myday.getDate());
var weekday = myday.getDay();
alert(weekday);
if (weekday == 6 || weekday == 0 ) {
if (message=='') message = element.name+" faild in my test.\n"
message = 'We are close on Saturdays and Sundays.\n';
ff_validationFocus(element.name);
return message;
} // if
return '';
} // ff_bfQuickMode7256046_validation
The probelm is I get two different numbers for WEEKDAY on two different computer. So are you telling me that getDay() should return the same value globaly for all OS or setting..?
Mazy
"This chancy chancy chancy world."
|
|
|
|
|
AFAICT it should - people seem to have problems parsing the date in the first place. I'd put a breakpoint on/after this line:
var myday = new Date(element.value) ;
myday will probably be different across the OSs (and possibly browsers). You might be better off splitting element.value yourself and using the constructor function Date (year, month, day)
|
|
|
|
|
Thanks I will try that and see what happen
Mazy
"This chancy chancy chancy world."
|
|
|
|
|
My date is like this: 2016-02-07 ( YYYY-MM-DD )
Mazy
"This chancy chancy chancy world."
|
|
|
|
|
i want to compare dates .
startjourney=moment(moment($('#onDate').val()).format("DD/MM/YYYY")+' '+ $('#starttime').val(),"DD/MM/YYYY h:mm A");//concate date and time am getting 27/01/2016 12:00 AM
newDate=moment(startjourney).add(mapDuration[0],'days').add(mapDuration[2],'hours').add(mapDuration[4],'minutes').format("DD/MM/YYYY hh:mm A");//29/01/2016 10:17 AM
// returnJourneyDate=newDate.split(" ")[0];
//
// endTime=moment(newDate.split(" ")[1]+ ' '+newDate.split(" ")[2],"h:mm A ");
// selectedTime=moment($('#starttime').val(),"h:mm A");
alert(moment($('#returntime').val(),"HH:MM").toDate());
selectedjourney=moment($('#returndate').val()+' '+ moment($('#returntime').val(),"HH:MM")).toDate();//concate date and time as strings
selectedDate=moment(selectedjourney,"DD/MM/YYYY h:mm A").toDate();
var date=new Date(selectedjourney,"DD/MM/YYYY hh:mm tt");
var d=moment( $('#returntime').val(),"HH:MM").toDate();
var h=new Date(selectedDate);
if(selectedjourney.isBefore(newDate))// test selected one is before newDate
bootbox.alert( "Return journey time must be after " + newDate);
|
|
|
|
|
|
You seem to have forgotten to ask a question.
You've told us what you want to do; you've shown us the code you've got; but you haven't told us what the problem is.
If you're getting an error, post the full details of the error, and tell us which line of code it's thrown from.
If it's not doing what you want, tell us what the inputs are, and describe what it's actually doing.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
I want to convert HTML div into image by java script.
|
|
|
|
|
|
Currently I am having one url with www.domainname/countrycode
1.at present my countrycode is default lets say Uk.
2.my requirment is according to my country location my url should append with countrycode.
Ex: if I type url from India ---> www.domainname.com/in
from UK --> www.domainname.com/uk
|
|
|
|
|
You also posted this in the asp.net forum, you should at least know what technology you want the solution to use so that someone can help you.
|
|
|
|