I have a form with "image" field where unlimited image fields can be added by clicking on "add another item" button. After 40 image fields, I get an ajax error "An error occurred while attempting to process /system/ajax: ajax.form.ajaxSubmit is not a function". Ajax call is failing and returning some JS files in response which is wierd. Appreciate your thoughts and suggestions.
The work around that I could figure out is to remove the ajax calls and do with usual POST method where the form refreshes by clicking on "add another item". Drupal is smart enough to remember all the rest of the values that the user filled in the form.
It could be due to the number of input variables you are posting across to the Ajax call. Check the value you have for 'max_input_vars' in your php.ini, and try increasing it.
Related
I have this flow but don't know how to deal with it. I think "Forward" button should use GET because it is safe and idempotent but the textarea contains a large amount of text so I think can't put in in URI. I changed to POST.
The OK button on confirmCreateAlbum surely POST.
The flow says When click "Cancel" on confirmCreateAlbum, it returns to nameAlbum with the fields were filled for editing. I put OK button in a form with action="confirmCreateAlbum". The problem is how to back to nameAlbum?
Note: nameAlbum will show errors if the required fields are not provided.
Although there is no specific length limitation for GET requests in the RFC, browsers impose limits on URI lengths. There are also considerations with some server implementations.
You said the textarea "contains a large amount of text" so it is recommended to use POST in this situation because it won't be subjected to URI limitations.
On to your original question, "The problem is how to back to nameAlbum?"
In your confirmCreateAlbum form, you can actually use two separate forms. A form for the "OK" which the action calls your specified script for confirming, and a form for the "Cancel" which has an action calling your nameAlbum form.
Anther option is getting clever with hidden input fields and passing the data around but that can get messy.
Personally, if it were up to me, I'd be using jQuery/Javascript for confirming form submission. It's a simple client side solution that doesn't require you to leave your original form if "Cancel" is pressed. But that's just me...
I don't think post or get is the problem here.
You can create two form: one with the ok button, post/get to further step; one with the cancel button, post/get to nameAlbum.
Or you can create one form with two button with same name and two different value and post/get to some page. On that page you check the value and redirect to further step or to nameAlbum.
After posting to confirmCreateAlbum, where do you store the data from the textarea?
I assume you store it in the session so in nameAlbum you can fill the data (if there's any) to the field.
And if you can use javascript, you can just handler the next, cancel button with some javascript and avoid some round trip.
I have a drupal website with a multi cck field (or how is it called? when you can "add another" field with ahah).
The problem is, when I click add another, everything works fine, but if I wait 5 minutes or so, and I click again, all the ahah fields disapear.
My post is done correctly, but my data response, which should contain the html of the fields, is empty.
Does anyone have an idea about this ?
Ok, I found the answer.
In ahah form use, the form is loaded from the cache "form_get_cache()". Every 3 minutes a cron jub runs, and clears the cache, that's why the from can't be retrieved and is empty.
An outside vendor did some html work for us, and I'm filling in the actual functionality. I have an issue that I need help with.
He created a simple html page that is opened as a modal pop-up. It contains a form with a few input fields and a submit button. On submitting, an email should be sent using info from the input fields.
I turned his simple html page into a simple aspx page, added runat=server to the form, and added the c# code inside script tags to create and send the email.
It technically works but has a big issue. After the information is submitted and the email is sent, the page (which is supposed to just be a modal pop-up type thing) gets reloaded, but it is now no longer a pop-up. It's reloaded as a standalone page.
So I'm trying to find out if there is a way to get the form to just execute those few lines of c# code on submission without reloading the form. I'm somewhat aware of cgi scripts, but from what I've read, that can be buggy with IIS and all. Plus I'd like to think I could get these few lines of code to run without creating a separate executable.
Any help is greatly appreciated.
If you don't want the page to reload after submission, you will need to use AJAX. that is alot more complicated. you would still need the submit.aspx, you cannot send email with javascript.
Code a redirect after the form submission, so instead of getting the same form back in the main document/page, you could get something like a blank page saying "Thanks for your submission!" or something of that nature.
Might be more simple to redirect the user to a result page using Respone.Redirect that displays some sort of "Your email has been sent" message, or even just redirect back to the base page.
I have the following problem
I have a web framework built with classic asp that saves the page state in hidden textboxes, and then issues a submit to itself.
Before submitting, we have a javascript functions that saves the action in a hidden "action" input, and then performs the submit.
The page loads the state from those hidden texts, reads the action issued, reads extra parameters, like the id of the record to edit, and then builds the page accordingly.
I'd like to make a url link to automatically start the page with "edit" action on a "x" id.
So I was thinking about building the following url, for example
http://myapp/user?action=edit&id=23
the problem is that when the page auto-submits, que url string keeps the parameters.
I'd like to achieve the following:
when the user clicks on
http://myapp/user?action=edit&id=23
my page should receive the posted values action=edit and id=23
but the url should be just http://myapp/user
and both parameters should be kept in the hidden texts... (I wonder if I make myself clear...)
thanks a lot
saludos
sas
ps: I have a couple of ideas about how to solve it, but I'll post them as answers...
The first solution that came to my mind was to save the values in the session, issue a redirect without the parameters, and then load the parameters and remove them from the session...
the other solution, and the easiest one to implement, is that whenever I read parameters I first read them from the querystring (request.queryString) and then overwerite them from the posted values (request.form)
that way I wouldn't care if the parameters from the querystring keep being sent, the only problem left would be the annoying url...
Pls somebody help me with viewsate. Suppose i have created two forms. First form contains First name and Last name and one button called NEXT. And Second form contain two fields and two button like Back and Save. While i am entering some value in form1 pressing one NEXT button and redirecting to second page. There when i am pressing Back button from second page it should come to first page whichever data i filled should exists, but in my case its not showing only empty form i can see when i am pressing on back button.
For this i have used viewstate mechanism. in page directory i have set enableviewstate=true.
postbackurl in both the button. Pls somebody help me what is wrong with me.
Thanks,
Sumit
Viewstate won't carry information from one WebForm to another. It only carries information across postbacks on the same WebForm.
You want to use another method, like SessionState, to carry information from the first page to the second page. Otherwise, you could combine all your inputs on the same page and separate them into multiple steps using something like the ASP.NET Wizard control.
David Lively's suggestions of cookie or database solutions are good, too.
ViewState will help you ship data between views/postbacks of the same page, but isn't really going to help you when moving data between separate pages.
In your first page, populate a cookie or database with your form fields. Any form can then update the cookie, delete it, or what have you.
You can call a javascript function that is doing a "real" back. Maybe I am missing something but this is what I would do.
onClick="history.go(-1)"
When a page is called from some other page it is not a post back, it is viewed as if it is a first time call... When a page is called from the same page then it is termed as a post back... View state or in the sense control values are maintained only during post back, and gets reseted to form values during first time call...
This is the reason behind why you are not seeing the values of the controls.
As others suggested, try using session or cookies and the best option would be Wizard.