Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Alert onSubmit page

  1. #1
    Join Date
    Feb 2010
    Posts
    63
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Alert onSubmit page

    When the input-text is too big or too small, you get a popup-message.
    e.g. 1. input : "e" - width : "100 cm" - popup : "text is too big ..."
    e.g. 2. input : "dynamicforum" - width : "5 cm" - popup : "text is too small ..."

    I want a popup-message ("Please edit input text") onSubmit the page when the input-text is too big or too small.

    TESTPAGE

    script : http://www.stickers.be/Eigen_Tekst_Afmeting.js
    (alerts on line 40 & 44 in script must be replaced by one alert onSubmit)

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The easiest thing would be to edit the script to make both alert texts read the same. Using a text only editor like NotePad, open up the file. Instead of trying to change the logic, simply change both:

    De tekst is te breed voor de geselecteerde breedte.
    and:

    De tekst is te smal voor de geselecteerde breedte.
    to:

    Bewerk tekst invoeren
    (Or that in better Dutch. I used Google Translate to get that. It doesn't always give the best translation or syntax.)
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Feb 2010
    Posts
    63
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    OK ... that is my goal.

    But how can I change the script to do it that way ?

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Use NotePad.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Feb 2010
    Posts
    63
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    I'am working with Dreamweaver, so I can edit the script there.

    But I don't know how I must change the script hitself.
    Now the popups appear when inputted text is too large or too small, without submitting the page.
    I only want the popup appear when submitting, clicking on "Add to shoppingcart" (green button : in wikelwagen).

    I hope you understand me.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Yes, I think I do now and I was wondering before if I did or not, I didn't. I will have a closer look at it. You could probably get rid of that entire script and use a form validation script instead. That's what you want, right, no alerts or reminders until the form is submitted?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Feb 2010
    Posts
    63
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Yes, no alerts until submit the form, except for the warning tekst after the dimension.

    You could probably get rid of that entire script
    The script is used to mesure the text.
    [ATTACH=CONFIG]
    [/ATTACH][ATTACH=CONFIG][/ATTACH]
    When the text is less then 1,3 mm or more then 58 cm (hight), a warningtext appears with after the dimension.
    I think you need this for the alert on submit ?
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	mesure-text.jpg 
Views:	155 
Size:	37.1 KB 
ID:	5273   Click image for larger version. 

Name:	mesure-text.jpg 
Views:	140 
Size:	39.7 KB 
ID:	5274  

  8. #8
    Join Date
    Aug 2009
    Location
    utf-8
    Posts
    205
    Thanks
    4
    Thanked 7 Times in 7 Posts

    Default

    Je kan detecteren de hoogte van de tekst, maar u kunt de hoogte van het beeld te detecteren zoals zo

    Code:
    was _URL = venster.URL || venster.webkitURL;
    $("#afvijlen").wijziging(functie (en) {
        was afvijlen, img;
        if ((afvijlen = deze.afvijlens[0])) {
            img = new afbeelding();
            img.onload = functie () {
                alert(deze.breedte + " " + deze.hoogte);
            };
            img.src = _URL.createvoorwerpURL(afvijlen);
        }
    });
    -------------------------------------------------------------------------

    (in het Engels)

    You cant detect the height of text, but you can detect the height of an image like so

    Code:
    var _URL = window.URL || window.webkitURL;
    $("#file").change(function (e) {
        var file, img;
        if ((file = this.files[0])) {
            img = new Image();
            img.onload = function () {
                alert(this.width + " " + this.height);
            };
            img.src = _URL.createObjectURL(file);
        }
    });

    Also anyone else reading this in English, Yammaski wants an alert to pop up when the text gets too big using a dropdown. So like if one option is to have the text at 12em another at 15em and one at 20em, an alert would show up at 20em because that text is too big. It is really hard for me to put my ideas down on this post, let alone to program the javascript, but I hope I can try to help.
    An inline div is a freak of the web and should be beaten until it becomes a span

  9. #9
    Join Date
    Feb 2010
    Posts
    63
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    So it's impossible to add the alert (on submit the page) to the script ?

  10. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    No one said that. And I didn't mean to throw away the other code. I guess I did say that. I meant not to use it for the alert at that point. You will probably want to keep some of the code because it's used to determine if the values are within the acceptable ranges. I also said you might want to use a validation script instead. You're already using jQuery on the page. So look into:

    http://jqueryvalidation.org/

    I would add as well that maybe you don't need an alert on submit. As long as error messages appear in the form itself, pointing the way for resolving the problem(s), all you really need is for it not to submit.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Replies: 11
    Last Post: 09-29-2012, 12:47 AM
  2. onSubmit dont want to clear form
    By vineet in forum JavaScript
    Replies: 2
    Last Post: 03-23-2009, 03:46 AM
  3. onsubmit in code
    By why not in forum JavaScript
    Replies: 3
    Last Post: 09-27-2008, 01:59 PM
  4. from onsubmit redirect
    By mini_minh in forum JavaScript
    Replies: 2
    Last Post: 04-19-2007, 05:07 AM
  5. Multiple onSubmit Attributes
    By gold2040 in forum JavaScript
    Replies: 2
    Last Post: 05-29-2006, 07:58 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •