- Screen name: anyhoo
anyhoo's Profile
4 Posts
7 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- 20-Nov-2013 11:40 AM
- Forum: jQuery Mobile
This is an issue which I have found no reference to but is I think a big problem that needs to be addressed. I have created a mobile web application using jQuery Mobile 1.3.0. In that web application I have made custom color themes using jQuery Mobile themeroller. When I run the mobile web application on an iPhone 5 running the latest OS (iOS 7.0.4) from Safari, I see the correct color themes. I had to clear the data cache in Safari first, but once I did that the colors show correctly. However, if I add the web application to the home screen and run it from the home screen icon (not from Safari), the correct color themes do not appear. I have tried everything I know to make the color theme appear correctly, even rebooting the iPhone entirely. Same results. This appears to me to be a big problem that surely someone has encountered before me. Since most iPhone web apps are run from the home screen, not having the correct color themes appear is intolerable. Why is this happening and what can I do about it?- 15-Oct-2013 05:28 PM
- Forum: jQuery Mobile
In an ASP.NET MVC 4 application, I have two forms, form A and form B.
Form A contains an input type=file control that allows a user to select an image file. Because it is uploading a file, it must be of enctype="multipart/form-data" and data-ajax must be set to "false" (because ajax will not handle uploading files).
Form B is a regular field type form that uses ajax. This form has validation on it, so that fields are validated on submit and if any field is invalid, then the form is redisplayed so the user can correct the fields.
The sequence of events in the application is that users first visit form A to select an image to upload and then visit form B to enter metadata field information associated with the image. Once the user submits form A, they are redirected to form B with a redirectToAction() command.
The problem I have been experiencing is that the data-ajax="false" directive on the first form is causing the following issue with the second form: For the second form, I can submit the form once and everything works fine, but on subsequent submits, the data from the first submit is all I see in the controller.
I verified this issue is being caused by the data-ajax="false" in the first form, as follows: If I set data-ajax="true" in the first form, then I can submit the second form as many times as I want to and each time it submits correct data. Also, if I bypass the first form entirely and go straight to the second form, I can submit as many times as I want to correctly. But, if I submit the first form with data-ajax="false" and the second form with data-ajax="true", then the issue presents itself.
I also noticed that if I set data-ajax="false" on the second form also, that it works correctly, but doing this causes other problems later in the application.
Somehow the fact that I have submitted the first form with ajax off interferes with the submission of the second form after the first submit and I have absolutely no idea why it is happening.
My thought is that the redirectToAction() statement between form A and form B is the cause of the issue. Can someone help me correct this?What I want to do is to keep the first form with data-ajax="false" and the second form at data-ajax="true" and have the second form submit correctly. How can I do this?
EDIT: Is this forum where threads go to die?
I have asked this same basic question before several times on other forums but not here. I hope someone here can help me solve this issue:
- I have a strongly-typed view with a hidden field on it.
- When the view renders server-side, I am setting the value of the hidden field to a property of the model.
- When the view renders client-side, I want to get the value of the hidden field (that was set during the server-side render) and display it in a java script alert box.
This should be a simple thing to do and yet I am unable to make it work. I have set a break-point in the view and I can see that the hidden field is being set to the correct value. But the javascript will not display that value.
The page/view being rendering has been gone to before. At the time I want to display this alert, I am going back to that page and now I want to see the alert.
It is as if the page is being cached, so instead of using the new value for the hidden field it is using the old value (from the first time the page was visited). If the DOM is being cached, how I can prevent that so that each time I visit the page I get the updated values of the page and not the cached ones? What am I doing wrong??- @<input type="hidden" id="hdnShowMsg" value="@Model.ShowMsg" />
- <script>
- alert($('#hdnShowMsg').val());
- </script>
Yes I have tried putting the javascript in the jquery pageinit event (and in every other applicable jquery event I could think of) and still get the same results.Yes I have the web browser configured not to cache.I am relatively new to jQuery and ASP.Net MVC but I do not see what I am doing wrong here. No one has been able to give me any useful feedback on this. This should be a very simple thing to do but I need help with it.- I am developing an ASP.Net MVC application and I have form containing a file upload HTML element and a submit button. When the user first goes to the view, I have javascript code automatically triggering the click event on the file upload HTML element so the user does not have to press the button themselves. This is for convenience and the way I want it to be, but when I trigger the button click automatically it is causing the following issue: I have to press the Submit button twice in order to submit the form. The first press clears the text in the file upload HTML element and the second press submits the form. Can anyone explain why this is happening and how I can get it not to do this?Note: The form is explicitly set not to use Ajax because I am uploading an image and from my understanding you cannot upload images via Ajax, so I turn that off with data-ajax = "false" in my form HTML attributes. Having this set to false is related to the issue I am having. If I submit via ajax, I only have to press the submit button once. If I do not use ajax, I need to press twice.I am using JQuery 1.7.1Here is the essential code I am using. In the below, if I both have data-ajax="false" in the form attributes and also automatically trigger the click event on the file input control, the issue presents itself.
@Using Html.BeginForm("Document", "NewDocument", Model, FormMethod.Post, New With {.enctype = "multipart/form-data", .data_ajax = "false", .id="submitimage-form"})
- @<input type="submit" id="accept2" value="Accept" data-mini="true" data-theme="b" data-icon="check"/>
End Using
<script>// Do once after DOM is loaded for the page
$(document).bind("pageinit", function () {
$("#fileInput").click();});
- </script>
- «Prev
- Next »
Moderate user : anyhoo
© 2013 jQuery Foundation
Sponsored by and others.

