Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

fortm

Members
  • Joined

  • Last visited

Everything posted by fortm

  1. function show(obj) { no = obj.options[obj.selectedIndex].value; count = obj.options.length; for(i=1;i<=count;i++) document.getElementById('profile'+i).style.display='none'; if(no>0) document.getElementById('profile'+no).style.display='block'; for (j=1;j<=count;j++) document.getElementById('error'+j).style.display='none'; if(no>0) document.getElementById('error'+no).style.display='block'; } function validate(id) { var x1=document.forms["myForm1"]["firstname"].value; if (id ==1 && (x1==null || x1=="")) { document.getElementById('error1').innerHTML='First name, form 1 must be filled out'; return false; } var x1=document.forms["myForm2"]["firstname"].value; if (id ==2 && (x1==null || x1=="")) { document.getElementById('error2').innerHTML='First name , form 2 must be filled out'; return false; } } <div><select onchange="show(this)" size="1"> <option value="1" selected="selected">first</option> <option value="2">second</option> </select></div> <br> <div id="error1"></div> <div id="error2"></div> <div id="profile1" onsubmit="return validate(1)" style="display: block;"> <form name="myForm1"> From 1 First name: <input type="text" name="firstname" /><br /> From 1 Last name: <input type="text" name="lastname" /><br/> <input type="submit" value="Submit" /> </form> </div> <div id="profile2" onsubmit="return validate(2)" style="display:none;"> <form name="myForm2"> From 2 First name: <input type="text" name="firstname" /><br /> From 2 Last name: <input type="text" name="lastname" /><br /> <input type="submit" value="Submit" /> </form> </div> From the above codes, I am making a drop down system to alternate between some forms. But, I am not able to save one form , when I go to another. Also error are not very user friendly. Need to show them as an overlay. Please assist on how to achieve this. I am new to JS and I am using PHP language.
  2. Yeah, you are right. I just did that by adding an IF condition on ERROR. If there is non empty error, then I show the DIV, else I don't.
  3. Hi There is an error handling code that I have added with CSS as below. .registration_error_message { background: #F1F1F1; color: #C00; line-height: 1.4; padding: 14px; -moz-box-shadow: inset 1px 1px 5px #CCC; -webkit-box-shadow: inset 1px 1px 5px #CCC; box-shadow: inset 1px 1px 5px #CCC; } span class="registration_error_message"><?php echo "ERROR SUMMARY"; ?></span> But the problem that I am facing in firefox and IE is that the grey box strip is always being shown even when there is no error. This does not happen with Chrome when used display as run in. Please suggest how to fix this for firefox and IE ? If I remove padding everythin works, but then error message doesn't look nice.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.